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)

0
votes
1answer
11 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 ...
4
votes
1answer
28 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
125 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
26 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
43 views

C readline function

I wrote this function for my next learning project (cfg parser). What do you think about it? ...
2
votes
0answers
17 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. ...
9
votes
3answers
474 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: ...
0
votes
0answers
14 views

JavaScript String.split on a string literal to produce an array [on hold]

I've seen a few javascript programmers use this pattern to produce an array: "test,one,two,three".split(); // => ["test", "one", "two", "three"] They're not ...
6
votes
4answers
203 views

Readline function

I have developed a readline function in C and I want to know your opinion on it: ...
4
votes
1answer
43 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
0answers
17 views

Cutting substrings in Haskell

How can I improve readability of this code? indentChar needs to be reused elsewhere. ...
2
votes
0answers
48 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
43 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
481 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
126 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
32 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
833 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
32 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
36 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 ...
12
votes
1answer
446 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
45 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
57 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
216 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
46 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
158 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
95 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
43 views

Regex to Match Email address

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

Zero pad function trim extra leading zeros

Here is a zero pad function I have: ...
14
votes
2answers
835 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
615 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
votes
0answers
13 views
1
vote
1answer
29 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
143 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
171 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
103 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
1
vote
1answer
67 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
80 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 ...
15
votes
4answers
231 views
+200

Name Filtering using a Trie

This question suggests a different (improved?) implementation for searching/filtering names based on a search query. This is based on the question here: Name filtering in Java A Trie allows the ...
5
votes
2answers
97 views

Find if a word with wildcard exists in dictionary [closed]

This is a question from a phone interview I had. The question was in 2 parts: a. find("cat") -> T/F suggest a data structure to find is if a word exists in a large dictionary, how will one node ...
6
votes
2answers
88 views

Name filtering in Java

I have a search box for searching for people in a list of names. Here is the code that runs every time the query changes. I could not find anything open-sourced for this, so I wanted to make sure ...
4
votes
2answers
154 views

Map String to list of string

Input: String : Title; List Tags Problem statement: Need to map title to tags, e.g. title is "china man japan beijing bell" and tags are ...
4
votes
1answer
54 views

Sentence formatting

I wrote this function to format a given sentence via Java, and I'm wondering if there is a better way of doing this without use of external libraries, such as with regex. ...
3
votes
2answers
51 views

split-string for R7RS

A split-string function seems to be missing in R7RS. I came up with the following implementation today: ...
1
vote
2answers
168 views

String 'expanding' - reinserting repeating characters

The challenge: Given a String, for each digit in that original string, replace that digit with that many occurrences of the character following it. So a3tx2z yields ...
6
votes
3answers
164 views

Checking for balanced parentheses

I wrote a method to check if each parenthesis in a string is closed. It should take into account the order in which a parenthesis is presented, e.g. "hello)goodbye(" should return false even though ...
10
votes
4answers
137 views

Morse Code String

I was bored recently and decided to write a class, MorseString. What this class does, is it takes a String that is coded like ...
4
votes
4answers
115 views

Getting the lengths of each word in its String parameter

Is this a smart method? ...
10
votes
3answers
355 views

Mutable String Class

Here is a String class that I've made for fun in my spare time, for myself. I have a few concerns about it, and am considering going immutable or a mix of the two ...