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)

-2
votes
1answer
31 views

String handling [on hold]

I have small doubt which is the best way to handle string in below scenario: Am i creating too many instance of string is it right way to do in the loop ...
4
votes
3answers
159 views

Find the inverted value of the string

How can this be optimized? ...
3
votes
1answer
42 views

What's your opinion on this approach to creating a repetitive string in Common Lisp?

I needed to have a Lisp function that could produce a string of a certain length, created by repeated concatenations of a another string given as argument (so for example by giving 10 and "abc" i ...
5
votes
1answer
113 views

String modification application

Below is working code of a semi complete program. Its purpose is to take an input string of any type and modify it based on rules defined for each type. So in this example I pass it a string in CSV ...
7
votes
2answers
72 views

Test string if numeric

I want to implement the following function: ...
7
votes
2answers
165 views

Given a page of content, determine shortest snippet containing all search phrases (no order required)

A recruiter gave me a homework problem as a part of the recruiting process and after receiving my submission he told me that he decided not to proceed with me. When I asked for the reason, he told me ...
4
votes
2answers
82 views

Rotating the string optimization

Below is the code for the problem at Codechef. I have made use of the String method .equals in my solution which is working fine ...
3
votes
2answers
43 views

Return the lexicographic order

Given set of words that are lexicographically sorted, return lexicographic order. E.g: abc acd bcc bed bdc dab The order of letters for the given ...
6
votes
4answers
169 views

Better way to repeatedly use istringstream in “counting minutes” challenge

I was doing this easy challenge "Counting Minutes I" from Coderbyte.com where you just calculate the number of minutes between two given times. The second time is always after the first, although it ...
6
votes
2answers
133 views

Count frequency of words in a given file

Write a function that takes two parameters: a String representing a text document an integer providing the number of items to return Implement ...
2
votes
2answers
56 views

Increase performance of string matching function

I've benchmarked my program, and have discovered that the single function taking the most time is the one that does the following. Takes string that is a delimited list, and splits it into ...
6
votes
2answers
80 views

String length calculation implementation in Assembly (NASM)

I just made a working implementation of calculating a string's length, but I'm not exactly sure it's the most efficient way. I divide the string up in blocks of four bytes each (32 bits), and add 4 to ...
11
votes
3answers
364 views

Pretty way of keeping sensitive info out of a logged command string in Ruby?

I have a long command that I am building with shovels (<<), with the intention of eventually running system(command). I'd ...
6
votes
5answers
133 views

Convert sequence of number into display string

My requirement is to convert a sequence of numbers into a display string as below. Example Input 1,2,3,4,5,7,7,8,8,8,10,15,10,11,12,88,87,86 Output 1-5,7-8,10-12,15,86-88 ...
3
votes
0answers
62 views

Aho-Corasick string matching in Haskell

I implemented Aho-Corasick string matching in Haskell. It is a purely functional implementation compared to many other implementations. The input to build an automata is ...
5
votes
2answers
161 views

Is this a good implementation of the split function?

I have this implementation of the split algorithm that different from .split() method you can use with multiple delimiters. Is this a good way of implementing it ...
7
votes
3answers
352 views

Better way to create a string of random characters

I'm generating domains with random names but I'm pretty new to Python. I used the map function because it packages the results into a list which I can then join() ...
4
votes
1answer
47 views

Increase performance of Boyer Moore

Here is my Boyer Moore code in Python: ...
11
votes
4answers
1k views

What would be preferred aesthetically and performance wise?

Which one of these two would you prefer writing in your code? This: ...
4
votes
3answers
95 views

Parsing httpline

I have an HTTP server class (.hpp & cpp). I am trying to improve reserve data from the socket class because I have s.getline() to get HTTP call. My ...
4
votes
1answer
50 views

More efficient way to make a Tweeter status in a string of just words

I am making an application where I will be fetching tweets and storing them in a database. I will have a column for the complete text of the tweet and another where only the words of the tweet will ...
7
votes
1answer
53 views

Making line by line replacements using values from multiple arrays

I currently have a Python script that parses a file (in this case an XML file) and makes line by line replacements as necessary, depending on the values of multiple arrays. As it stands now the script ...
2
votes
2answers
66 views

Transfer the format of an old string to a new string

First, I've extended the String class to detect uppercase and lowercase characters: ...
5
votes
1answer
41 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
98 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 ...
15
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
281 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
345 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 ...
7
votes
3answers
335 views

Eliminate duplicates from strings

I have written a piece of code for removing duplicated values from a string. Any suggestions on improvements? ...
6
votes
1answer
102 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
722 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
211 views

Conditional jump or move depends on uninitialised value

Please review the following code: ...
3
votes
1answer
78 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
106 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
403 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
43 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
57 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
97 views
3
votes
1answer
108 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
538 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
63 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
474 views

Anagram Checking

...
12
votes
7answers
1k 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
69 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
48 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
49 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
85 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
57 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
136 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
164 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 ...