A string is a sequence of zero or more 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)

5
votes
1answer
25 views

Convert list of parameters to a string that can be invoked

My PowerShell scripting skills are pretty poor, but I've managed to hobble together got this script: ...
2
votes
2answers
82 views

Speeding up and fixing phone numbers from CSVs with Regex

I've hodgepodged together an attempt to extract all phone numbers from all CSVs in a directory, regardless of where they are and what format they're in. I want all phone numbers to be printed to a ...
14
votes
7answers
1k views

Why does caching of string objects perform faster?

I'm trying to implement String-Pool. I'm maintaining a HashMap<String,String> to store the keys. ...
11
votes
4answers
229 views

Least significant digit (LSD) radix sort of strings

I am learning string algorithms and wrote this C example based on a Java example I found online. Any feedback relating to style, code clarity, whether it is generic enough to be re-used, interface, ...
4
votes
3answers
333 views

Can this list comprehension be made more pythonic?

Quite a specific question can the below code be made more clearer / pythonic in any way. Essentially based on the condition of the string x((len(x) / 3) - 1), I ...
6
votes
3answers
312 views

Eliminate duplicates from strings

I have written a piece of code for removing duplicated values from a string. Any suggestions on improvements? ...
5
votes
1answer
82 views

BBCode to HTML converter using functional programming

I was inspired to write a BBCode to HTML converter as I'm currently learning functional programming. I wanted achieve functional cohesion. jsFiddle I'd like feedback on: structuring of the code. ...
9
votes
5answers
689 views

Vertically placing the words in a string

Please let me know a better approach to solve below problem: Problem: Vertically arrange the words in a string and print on console. Sample Input: Hello Jack ...
5
votes
2answers
199 views

Conditional jump or move depends on uninitialised value

Please review the following code: ...
3
votes
1answer
69 views

Format string inline

For this project, I do not have access to Boost or C++11. Note: I updated the question's description to clarify what I am doing. I have not changed the code though, so no answer has been invalidated. ...
8
votes
3answers
94 views

Longest 'balanced' substring

I was given a task where given a string of '0's and '1's, return the longest substring where the count of '0's and '1's are equal. I was told also that the code should be O(n) and space O(1). Below ...
11
votes
7answers
365 views

Class for handling unit conversions

I am creating a class to be the end all defacto class for handling unit conversions. This is particularly difficult in my company's industry where imperial architectural strings are used as units. I ...
0
votes
1answer
39 views

Dealing with a dirty table

I have to deal with a really ugly looking response I get back from a particular device. The string represents a table. Each section of the string represents the form: ...
2
votes
2answers
43 views

Numbers to Text Program - Python Training

I have written a numbers to text challenge for some people in my organisation to practice their Python skills. I am an economist working with pandas, but I am trying to teach them some stuff about ...
4
votes
1answer
84 views
3
votes
1answer
79 views

Searching text files for string patterns that are each defined in their own classes

I'm trying to implement interfaces in my design but not sure if this is correct or if there is a better way to do it. What I need to do is open a text file keep searching blocks of text until I ...
8
votes
5answers
396 views

Read and convert binary files to ASCII text

This is my code which receives a file to read and converts binary values to ASCII text. The code works fine, so I am looking for a review on what I have written, and suggestions on how I could do it ...
5
votes
1answer
53 views

Balanced parentheses

Given an expression string exp, write a program to examine whether the pairs and the orders of "{","}","(",")","[","]" are correct in exp. For ...
6
votes
3answers
451 views

Anagram Checking

...
12
votes
7answers
907 views

Check for balanced parentheses

Given an expression string exp, write a program to examine whether the pairs and the orders of "{","}","(",")","[","]" are correct in exp. For ...
10
votes
2answers
66 views

Poke-a-Dot (Provider)

I need to create variable-length strings of dots/periods/full-stops to add to some text content, in a way that is similar to a formatted table-of-contents: ...
3
votes
1answer
45 views

Preprocessing Markdown Documents for Keywords

I recently added a feature to my application to serve arbitrary markdown documents from a directory. This is designed to allow authors to populate a folder full of help documents, and be able to view ...
5
votes
2answers
45 views

Find and replace String with a substring result

I was asked this recently, and I couldn't figure out the best way. We are trying to replicate Google's search results where the search terms are bolded (using a b tag) in the results. ...
5
votes
1answer
65 views

Extract code and convert special characters to HTML entities

I want users to enter their code into my blog and keep original styling tags intact. So I had to develop a function that extracts user's code (between two tags) and convert special characters to HTML ...
6
votes
1answer
51 views

indexOf() and Boyer Moore methods

I have a method I created which is a custom indexOf(). This code seems ugly to me so I was wondering if anyone could recommend a cleaner and perhaps faster ...
6
votes
2answers
120 views

Calculate Suitability Score program

I am a beginner in C++ and learning from textbook. I find it hard to jump into oops concepts as I have used C a lot. Here is an interview question I came across: Problem Statement Our ...
1
vote
1answer
142 views

Milliseconds to Time string & Time string to Milliseconds

Fast Time conversion I'm trying to write a very fast time-to-string and string-to-time function. I noticed that on low CPU mobile devices this function has, even if minimal, impact on the ...
5
votes
2answers
81 views
11
votes
7answers
985 views

Write a function to find the first non-repeated character in a string

Here is a practice question I am solving: Write a function to find the first non-repeated character in a string. For instance, the first non-repeated character in 'total' is 'o' and the first ...
9
votes
2answers
81 views

Printing permutations of a given string

I want some feedback on the program I developed in C for printing the permutations of a given string. ...
9
votes
3answers
181 views

Parsing comma-separated floats and semicolon-delimited commands

I wrote a cstring parser. It has to work with a relatively wide amount of arguments (usually 3 or 4, but maybe in future with a different amount), which are ...
9
votes
2answers
368 views

Converting a numerical string to the equivalent multipled by 100

Method: Input: a string which represents an integer or a non-integer value. Output: a string which represents the same value multiplied by 100. Requirements: No floating-point unless needed. No ...
4
votes
2answers
171 views

Alp in MASM 8086

If the number is present, the output should show the numbers that are not present. ...
5
votes
1answer
109 views

Simplify C# Helper Class to change property of string when serializing for Json.Net

Is there any way to simplify the following C# helper class to numerate a string for Json.Net? ...
2
votes
2answers
99 views

Handling C-like strings in C++11

We have two C-strings and for their concatenation we need to know the size of resulting string. And we want to calculate it at compilation stage. How can I improve this solution? ...
3
votes
2answers
169 views

Slug URL Generator

Just a slug generator. I'm wondering if this can be simplified any further. Many thanks. ...
7
votes
3answers
306 views

Reverse word by word efficiency

I have a method that reverse each word in a string. I want to know how I can increase it's performance and memory efficiency. Ideas I had in mind were simply using ...
5
votes
2answers
223 views

Insert a character into a string

For practicing reasons I would like to write a method which inserts a character into a string. I would like to know: What is the best practice concerning placement of a comment within methods? For ...
3
votes
1answer
82 views

Which approach is preferable string parsing?

I want to find total word count in string. I have two methods as mentioned below. ...
1
vote
1answer
70 views

reversing a string test cases

I am trying to create a method that reverses a string that will handle every case. So far the cases I have come up with are "" "abcdef" "abbbba" null I haven't ...
11
votes
4answers
626 views

Count number of each char in a String

I know there is a simpler way of doing this, but I just really can't think of it right now. Can you please help me out? ...
17
votes
5answers
760 views

Custom indexOf() without String methods

I created my own indexOf function. I was wondering if anyone could help me come up with a way to make it more efficient. I am practicing for interviews so the catch ...
7
votes
5answers
373 views

Fast way of searching for a string in a text file

I have written this code to search for a string in a .txt file. Is it possible to optimize the code so that it searches for the string in fastest manner possible? ...
15
votes
4answers
1k views

Reverse a string word by word

Given an input string, reverse the string word by word. For example: Given s = "the sky is blue", return ...
5
votes
1answer
62 views

Coderbyte: String Reduction

From Coderbyte: Have the function StringReduction(str) take the str parameter being passed and return the smallest number you can get through the following reduction method. The method is: ...
-2
votes
2answers
63 views

Remove leading, trailing and repeated dashes from a string [closed]

How do I refactor this? '-hello--world-'.chomp('-').squeeze('-').reverse.chomp('-').reverse # => 'hello-world'
4
votes
2answers
60 views

Is my simple string tokenizer wrapper orthogonal?

I always learn something from Code Review, so if anybody could point out any bad practices in design, violations of DRY, or orthogonality problems I would be extremely grateful! ...
7
votes
2answers
120 views

Generate permutations with symbols

Goal: Create a combination of emails based from inputted first name, last name, middle name, and a domain. Add in common separators. Then I'll check which one is correct with the rapportive API. This ...
7
votes
3answers
89 views

Collect and calculate average times from log, then display top 10 longest durations

Here's a novel-length summary of the issue: I'm trying to write a VB.net program to help me collect remote site statistics from system-generated logs, but I'm a little like a carpenter who only knows ...
6
votes
3answers
67 views

Produce an array of strings from a single string

I have a function that reads a string like this (AnimalCount+HumanCount) and the result of this function is an array of strings ...