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)

5
votes
2answers
214 views

Identifying which paragraph, if any, is a superset of all words in a document

Description need to find out the paragraph number which is containing all the words in the file. input file java.txt What is a JVM? What is the most ...
6
votes
2answers
115 views

Splitting three comma-delimited strings

I've been reading about loops this morning, to try to improve this snippet of code: ...
2
votes
2answers
215 views

Text tokenizer - extract words and positions from text

I have Set of character delimiters (DELIMITERS), eg . ...
3
votes
2answers
43 views

Titleize words in a sentence but with some conditions

Below is the code I have written to capitalize all the words of a sentence except if The words belong to the littleWords list. The word would be capitalized if it's the first word of the sentence ...
2
votes
2answers
116 views

Vowels in a string, patterns

Checking if all five vowels are present in a string. ...
4
votes
5answers
106 views

Optimising single-delimiter string tokenisation

I am trying to optimise my tokenizing of tab delimited strings: ...
0
votes
1answer
33 views

Permutations of a string

I wrote the following code to permute the characters of a string assuming there is no repeated character. I also want to make sure the space complexity of this algorithm is \$O(n*n!)\$: There are ...
0
votes
1answer
24 views

Natural sorting/comparing algorithm in TypeScript

This code sorts string that may contain numbers in natural order, that's it, "item 2" comes before than "item 10". It currently ignores case. I plan to implement options to handle case sensitivity and ...
1
vote
2answers
24 views

String appending function (location-independent)

Very useful operation that hasn't been merged into a function.. until now. This is supposed to insert a substring into a previously d.allocated source string. ...
1
vote
2answers
33 views

Work out if a string is “fieldname” or “tablename.fieldname”, and assign variables

Is there a neater way to write this code? ...
3
votes
3answers
139 views

Count chars, words and lines

Any suggestions are welcome. ...
3
votes
2answers
59 views

Counting the proportion of vowels in substrings

I'm looking for an algorithm to make my code faster and better for big strings. Problem link Let the simple prettiness of a string be the count of vowels (I, E, A, O, U, Y) divided by the length of ...
6
votes
2answers
53 views

Basic String class

I wanted to create a basic String class that will hold a CString and have: constructor, destructor, copy constructor ...
1
vote
1answer
27 views

Read file directly - simplified

In order to read a whole file as a string using standard libraries you have to allocate memory, terminate the string, determine size of the file and size of each element. This could happen with ...
6
votes
1answer
77 views

A super string cleaner

I need a method that clean up a string considering these few rules: Remove or not Spaces Remove or not Special Chars Remove or not Numbers Descaptalize or not the string (this is don't really needed ...
2
votes
2answers
153 views

Get alpha numeric count from a string

Following is the code I am using to find a separate count for alphabets and numeric characters in a given alphanumeric string: ...
1
vote
2answers
35 views

Checking consecutive characters in a string

First of all, this code will ask for a number (first) on how many test the user would like to have. Then the user will input the strings depending on how the number entered. ...
5
votes
4answers
51 views

C readline function

I wrote this function for my next learning project (cfg parser). What do you think about it? ...
2
votes
0answers
32 views

Representing Objects as strings in VBA

I am working an a more meaningful way to print objects in VBA. The desired result should look something like this. ...
10
votes
3answers
488 views

Usage of StringBuilder for returning copies of a string

Given a string and a non-negative int n, we'll say that the front of the string is the first 3 chars, or whatever is there if the string is less than length 3. Return n copies of the front: ...
6
votes
4answers
205 views

Readline function

I have developed a readline function in C and I want to know your opinion on it: ...
4
votes
1answer
49 views

Multiplying Lists

Challenge: Given 2 lists of positive integers. Write a program which multiplies corresponding elements in these lists Specifications: Your program should accept as its first argument a ...
1
vote
1answer
33 views

Cutting substrings in Haskell

How can I improve readability of this code? indentChar needs to be reused elsewhere. ...
2
votes
0answers
53 views

Function to split a given string according to predefined patterns

Just started to use PostgreSQL and want to be sure that I'm not making any mistakes. Here's a function that splits given string according to predefined patterns. It's part of a trigger function used ...
1
vote
0answers
44 views

Matching file names to an array of product SKUs

The Challenges: There are many SKUs, (around 50,000) which I'm trying to match to around the same number of image files. SKUs contain characters that are not legal in filenames, which must be ...
12
votes
2answers
499 views

Reverse a sentence quickly without pointers

I am trying to reverse a sentence contained in a string and return a string in the quickest way possible using the least amount of memory. Also I don't want to use any unsafe code, so no pointers are ...
3
votes
2answers
134 views

Uppercase the initial char of every string in a list

My problem is that I have a sequence, potentially infinite, of strings. Let's suppose it to be {"Mickey Mouse", "Bugs Bunny", "Winnie the Pooh"} I have to make ...
4
votes
1answer
33 views

String manipulations (reverse a string by characters, permutation)

I'm trying to solve simple Java problems in various ways. Could anyone comment about the code, like how it could be better, and what could be a problem? ...
8
votes
5answers
853 views

Assembling a user agent descriptor, implemented using StringBuilder vs String

I think performance won't be a big issue here as the concatenation only happens once (2-3 at worse because of multiple threads). Out of the two methods, which one would you prefer, in terms of ...
1
vote
1answer
33 views

Memory searcher function test

This is part of the project I started just now. It is a function that returns the offset address of a first occurrence of a string match into a given range of memory blocks. ...
-2
votes
1answer
40 views

Clojure koans 14 - converting a map to a string

The koan is at the end of this snippet. It requires you to write a function to convert a map to a string, and then prepend a full name to it. The following solution works fine. I am just wondering if ...
13
votes
1answer
470 views

Capitalize the first character of all words (even when following a '-')

I got it working, all variations are displayed Sint-Anna as should be, but I wonder, is there a simpler way to this, since it looks very cluttered? ...
3
votes
2answers
47 views

Python path-breaking script for use in R

R does not support line continuation as Python, and it's disturbing to have long file paths like /media/user/data/something-not-very-important-but-super-long/some-curious-secret-file.pdf and ...
3
votes
1answer
76 views

Finding the shortest substring containing keywords

Problem: Write a function that takes a String document and a String[] keywords and returns the smallest substring of ...
5
votes
2answers
227 views

C# approach to prevent null references in strings

My insight here is that it's usually not useful to distinguish between null and empty strings. Sometimes it is, but usually not. Usually I like to assign my strings ...
3
votes
1answer
48 views

All balanced parentheses for a given N

Write a function (in Haskell) which makes a list of strings representing all of the ways you can balance N pairs of parentheses: Example: ...
3
votes
4answers
166 views

Java vs C++ (JAVAC)

Here's the problem for Java vs C++ (JAVAC): Java and C++ use different naming conventions. In Java a multiword identifier is constructed in the following manner: The first word is written ...
2
votes
3answers
123 views

Counting the UpperCase, LowerCase, Numbers and Special Characters in a String

I'm making a Java program that will analyze the given String by counting the lowercase, uppercase, numbers and special characters. Is there a way by making it functional? ...
1
vote
2answers
46 views

Regex to Match Email address

I have the below regex to match email address with atleast one @ and one . ...
3
votes
3answers
77 views

Zero pad function trim extra leading zeros

Here is a zero pad function I have: ...
14
votes
2answers
838 views

The Breakfast Club attendance

This code checks a string called breakfastHours similar to 1567 which translates to Monday, Friday, Saturday, Sunday. ...
6
votes
1answer
633 views

Implementing a C++11 raw string class

I'm trying to implement a RawString class that conforms to C++11: ...
2
votes
2answers
54 views

Ordering Gallery images by custom order

I wrote some code a few weeks ago, to take a string similar to seq[]=8&seq[]=7&seq[]=5&seq[]=1&seq[]=4&seq[]=3&seq[]=6&seq[]=0&seq[]=2 and put it into a gallery, ...
1
vote
1answer
31 views

Print all subsets and permutations of a string

The following code is designed to accept a string from the user that is at most 5 characters long. It will then find each possible substring of the string and print all possible permutations of each ...
4
votes
3answers
148 views

Extracting numbers before colon

I need to extract all numbers before a colon in a string, e.g.: abc1234:blah -> 1234 5n63:124 -> 63 stringwithnocolon -> "" stringwith:nonumber -> "" Limitations: no external dependency (looking ...
4
votes
4answers
196 views

Truncate String to target length using only whole words

I've got a bit of code that I'm wanting to tidy up. The aim is to take a String that consists of multiple words connected by a separator (It's produced using ...
5
votes
2answers
105 views

Get line from string function

I have asked a previous question but at the last moment I realized that the code does not work as intended as it has some small bugs. I got some ideas for improvement though, but they didn't seem to ...
-2
votes
2answers
51 views
2
votes
1answer
74 views

Determining the existence of string Intersections

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 ...
3
votes
1answer
83 views

Finding the length of the largest run

Note: A run is a series of adjacent chars that are the same. I just want to answer a few questions: Is this readable? Does it need commenting or is it self-descriptive enough? Are there any ...