A string is a sequence of characters. It is commonly used to represent text or a sequence of bytes. Use this tag along with the appropriate programming language being used.

learn more… | top users | synonyms (1)

0
votes
0answers
4 views
4
votes
4answers
103 views

A custom String Builder implementation

Two code files below : the actual logic & the test logic. Core Logic ...
5
votes
1answer
46 views

Calculating protein mass

This question is part of a series solving the Rosalind challenges. For the previous question in this series, see A sequence of mistakes. The repository with all my up-to-date solutions so far can be ...
5
votes
1answer
84 views

Checking that a password contains a '$', a digit, and an uppercase letter

I have this code, which reads in a string password from the user and checks if it has a dollar sign $, a number, and an upper case letter. If it has all three, it ...
3
votes
1answer
30 views

X-up utility for EVE Online

I am learning Rust. I also play EVE Online – a video game about internet spaceships. I decided that it would be fun to practice Rust by writing a simple utility to help me x up. to x up (verb) ...
3
votes
1answer
32 views

Extracting the first two initials of a person's name

I've come up with a hackish approach to get my XSL function to only return the first 2 initials of a person. I think there should be a more efficient way to do this though. The ...
3
votes
1answer
49 views

Anagram in Scala

Code ...
4
votes
2answers
41 views

Inserting data into a file

So, given a file with the following format: [header] line of data line of data line of data line of data [header 2] line of data line of data line of data ... I add a ...
4
votes
2answers
87 views
0
votes
0answers
37 views

Time limit exceeded for solving longest palindromic substring by dynamic programming

I have seen plenty of longest common substring search code by dynamic programming and it is an O(n^2) operation. My motivation is to solve leetcode problem longest-palindromic-substring by this ...
0
votes
0answers
20 views

Reduce encoded length of UTF-8 encoded Ruby string in C extension

I'm writing a Ruby extension in C. It's a string processing module working on UTF-8 encoded strings only. One method, full_width_to_ascii!, converts full width ...
1
vote
1answer
105 views

Custom Exception.ToString() formatter

I find the default Exception.ToString() formattig very difficult to read especially if there are inner exceptions involved. I guess everyone knows how it looks: <...
2
votes
2answers
72 views

Returning a filtered list of iPhones

I have just received feedback regarding a junior dev test that I submitted. It was unfortunately not great, and the recruiter could not articulate the issues, I tried to show that I was thinking about ...
0
votes
0answers
21 views

Defining long, multi-line string-literals in VBA [closed]

I'm writing a helper in C# (for inclusion in Rubberduck) that takes text from the user's Clipboard and reformats it for insertion into a VBA module as a string-literal. The goal is to allow the ...
2
votes
1answer
34 views

Sorting the array of strings on their lengths in Java , Using Maps, ascending order…

I wrote the java method to answer this question : Write a Program to sort String on their length in Java? Your method should accept an array of String and return a sorted array based upon the length ...
-3
votes
0answers
50 views

C++ program hung at receiving input (Google codejam 2009 problem) [closed]

Hi I'm trying to solve the following problem: http://code.google.com/codejam/contest/dashboard?c=189252#s=p0 I'hv written the code, but my program keeps receiving infinite inputs. I tried to convert ...
1
vote
3answers
82 views

Recursive function that reverse the words in a string

I have been working on a problem that asks me to a write recursive function that can reverse the words in a string. For example if the string is "cat is running", then the result should be "running is ...
3
votes
0answers
53 views

Subtraction in a spreadsheet column numbering scheme

The idea of the algorithm is to decrease a number from a word. Is there a better way to write this algorithm? limitiation: it is important to decrease with a limit, if BB is the word we decrease ...
2
votes
2answers
52 views

Simulate the “cd” command of a file system

Write a function that provides change directory (cd) function for an abstract file system. Notes: Root path is '/'. Path separator is '/'. Parent directory is addressable as "..". Directory names ...
11
votes
3answers
263 views

Constant-time string equality check

This is my attempt to answer my own equally named question on SO. In this case, I need a method comparing two strings so that the running time is input independent. ...
7
votes
1answer
57 views

Longest lines using priority queue

Inspired by a comment on this question, I thought I'd exercise my C skills by implementing something like it using a priority queue. The idea is to be able to invoke the program like this: ./...
6
votes
2answers
762 views

C the large print

This is the Longest lines challenge from CodeEval: Challenge Write a program which reads a file and outputs a specified number of lines, sorted on length in descending order. ...
4
votes
2answers
100 views

I can has(kell) moar cheezburgers?

KITTEH HAS IMPROOVD CODE SKILLS, AN NAO HAS BETTR CODE 4 U This is an improvement of my original Haskell Lolcats Translator, and now features a function to do the translation (recursively?) using a ...
3
votes
3answers
864 views

Making as many unique strings as possible by removing two characters

I'm attempting a programming challenge type task in C#, where the goal is to determine how many unique strings can be obtained by removing two characters. The prompt for the task implied that I should ...
8
votes
1answer
115 views

Snakes and Letters

This is the "Clean up the words" challenge from CodeEval: Challenge Given a list of words mixed with extra symbols. Write a program that will clean up the words from extra numbers and symbols....
7
votes
4answers
901 views

No more filthy words

Challenge Given a list of words mixed with extra symbols. Write a program that will clean up the words from extra numbers and symbols. Specifications The first argument is a path to a file. ...
3
votes
0answers
58 views

An utility Java class method for nifty and informative conversion of a double matrix into a string

I have coded this static method for converting a double matrix into a nifty String. It considers the width of the matrix to be ...
4
votes
1answer
86 views

C++ Wide string utility class

I created a class to add functionality to c++ std::string (std::basic_string actually), let's call it ...
19
votes
4answers
5k views

I can has(kell) cheezburger?

Edit 13 June: I have made a new and improved version here. Original Question This is a very rudimentary lolcats translator (it only works on the phrase "Can I have a cheeseburger") in Haskell. This ...
2
votes
1answer
54 views

Extendable format provider

I needed a better string formatting options like ToUpper and ToLower but I also wanted to be able to use the default formattings ...
6
votes
1answer
36 views

Quoted string parser

I have written a string parser that is designed to split a string by spaces, excluding spaces wrapped in strings. Here is some example inputs and outputs: ...
2
votes
2answers
45 views

A sequence of mistakes

This question is part of a series solving the Rosalind challenges. For the previous question in this series, see The Genetic Code. The repository with all my up-to-date solutions so far can be found ...
2
votes
1answer
49 views

Find all distinct combinations of letters in a string

I've been preparing for interviews and picking up modern C++. A recent prep question I did was to find all combinations (or distinct subsets) of letters from a string. E.g. ...
6
votes
1answer
70 views

Counting newlines in a file

I've started to go through Node tutorials on nodeschool.io, and the second assignment was to write a program that will count the number of newlines in a file and print it out. My solution looks like ...
3
votes
1answer
50 views

Hackerrank Funny String python solution

"Funny String" problem from Hackerrank Suppose you have a String, \$S\$ of length \$N\$ indexed from \$0\$ to \$N-1\$. You also have some String, \$R\$, that is the reverse of \$S\$, where \$S\$ ...
3
votes
2answers
93 views

Determining if two Strings have common subtrings of a given length in Java

Problem: Given 2 strings, consider all the substrings within them of length len. Len will be 1 or more. Returns true if there are any such substrings which appear in both strings. Compute ...
2
votes
3answers
311 views

Getting the index of a character within the alphabet

I've made this function to map alphabetic coordinates to their corresponding ordinal number. ...
0
votes
2answers
67 views

Creating a definition text from 3 string arguments

Here is my code to create a definition text from 3 arguments. Is there any way to make it work with better performance and look nicer? ...
3
votes
0answers
46 views

Parse long string in Go

I'm sure that my server can work with better performance, but it's just a dream. Parsing a very long strings is not so obvious task for me. I have a server that handles a lot of clients requests and ...
3
votes
1answer
52 views

PHP class which preserves line break by splitting the line into as many line break as it have

Can anyone here please review my PHP code which preserves line break by splitting the line into as many line break as it have? ...
4
votes
1answer
102 views

Improving time complexity of finding the longest palindrome in Python

The Longest Palindromic Substring challenge from InterviewBit: Given a string S, find the longest palindromic substring in S. where a "substring" must be contiguous, and in case of ties the ...
1
vote
3answers
84 views

RadixSet - A growing-only Radix/Patricia Tree

I'm looking for a structure to store large amounts of strings (5k to 100k) and then test for existence of new strings against the previous inserted data, in the least possible amount of time (memory ...
4
votes
3answers
922 views

Top 5 most common words in Python

I would like to hear feedbacks from an interviewer's perspective on how to improve the following code: ...
2
votes
4answers
364 views

String Reversal

Wrote a practice code for reversing a string say. Input = "This is funny" Expected output = "ynnuf si siht" This code works for me. Want to know your comments and a better optimised way to perform ...
1
vote
0answers
24 views

Directory listing in Node.JS

This solution works, and I like having all the logic after the return. The main purpose of this function was for use with other functions to return a file list: ...
-5
votes
1answer
42 views
4
votes
1answer
46 views

Count words in string and tally up the repetitive words

I'm an elixir beginner. I'm doing the word count exercise of exercism website. The word count exercise returns a map with the word as the key and the number of instances as value. The exercise ...
7
votes
1answer
106 views

Building a string representing 50+ ActiveDirectory options

I have a switch statement used to handle options that a user selected (stored in an array). The array is iterated through, and for each element (enum object) in the array, an appropriate action is ...
3
votes
4answers
93 views

Method for String Building in java

I have written a custom method to use StringBuilder in java. My Requirement is to create a method which accepts any number of arguments of any type and return String by concatenating the arguments. ...
0
votes
3answers
97 views

Detecting if two given strings are isomorphic using Java data structures

So I have written the following code and it works for various same length isomorphic strings I have tried. However I am not sure what are some time complexity improvements and coding tweaks that could ...