string Questions
6
Solved
Consider the following input string:
'MATCHES__STRING'
I want to split that string wherever the "delimiter" __ occurs. This should output a list of strings:
['MATCHES', 'STRING']
To sp...
7
Solved
In Objective-C I used to convert an unsigned integer into a hex string with:
NSString *st = [NSString stringWithFormat:@"%2X", n];
I tried for a long time to translate this into Swift bu...
4
Solved
I am parsing some delimiter separated values, where ? is specified as the escape character in case the delimiter appears as part of one of the values.
For instance: if : is the delimiter, and a ce...
4
I'm wanting to capitalize the fist letter of a string but leave the rest
What I have:
racEcar
What I want:
RacEcar
Laceylach asked 2/8, 2015 at 0:49
14
Solved
I have a set of strings, e.g.
my_prefix_what_ever
my_prefix_what_so_ever
my_prefix_doesnt_matter
I simply want to find the longest common portion of these strings, here the prefix. In the above ...
4
Solved
There is a function similar_text() in the PHP library. The documentation (http://php.net/manual/en/function.similar-text.php) tells me that "This calculates the similarity between two strings...
Varden asked 21/6, 2010 at 12:32
9
Solved
Just wondering, is there any equivalent in VBA to VB .NET's PadLeft and PadRight methods?
As of right now, whenever I want to take a string and make it a fixed length with leading spaces, I do a F...
6
Solved
In my current program one method asks the user to enter the description of a product as a String input. However, when I later attempt to print out this information, only the first word of the Strin...
Theolatheologian asked 30/10, 2011 at 17:49
6
Solved
Months ago I made a short code that uses mb_strimwidth() to exactly fit some text into a table cell, putting dots at the end of a truncated string.
Now, after some times, I tried to execute that sa...
Blende asked 10/1, 2013 at 9:50
5
Solved
Good day,
I would like to know if there is an easy way to chunk/split a string without breaking the words.
Eg:
var input = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin placera...
Overview asked 9/7, 2011 at 3:29
45
Solved
A palindrome is a word, phrase, number or other sequence of units that can be read the same way in either direction.
To check whether a word is a palindrome I get the char array of the word and co...
Jochbed asked 9/11, 2010 at 21:28
106
How do I make the first character of a string uppercase if it's a letter, but not change the case of any of the other letters?
For example:
"this is a test" → "This is a test"
...
Ori asked 22/6, 2009 at 8:25
5
Solved
I have a data frame similar to the one below:
Name Volume Value
May21 23 21321
James 12 12311
Adi22 11 4435
Hello 34 32454
Girl90 56 654654
I want the output to be in the format:
Name Volume Va...
10
Solved
Is there a nice way to iterate on the characters of a string? I'd like to be able to do foreach, array_map, array_walk, array_filter etc. on the characters of a string.
Type casting/juggling didnt...
Reamonn asked 5/1, 2011 at 5:14
14
3
Solved
I'm dividing a very long into much smaller number. Both are of type decimal.Decimal().
The result is coming out in scientific notation. How do I stop this? I need to print the number in full.
>&...
Scherzo asked 7/6, 2021 at 23:19
6
Solved
What is the difference between backticks (``) & double quotes ("") in golang?
Ramiform asked 24/10, 2017 at 18:12
17
How do I split a string into a list of characters? str.split does not work.
"foobar" → ['f', 'o', 'o', 'b', 'a', 'r']
13
Solved
I have an array of Strings that represent Binary numbers (without leading zeroes) that I want to convert to their corresponding base 10 numbers. Consider:
binary 1011 becomes integer 11
binary 100...
23
Solved
12
Solved
I would like to count the number of lines in a string. I tried to use this stackoverflow answer,
lines = str.split("\r\n|\r|\n");
return lines.length;
on this string (which was original...
Crossbill asked 13/12, 2011 at 11:49
5
Solved
I want to count the frequency of occurrences of all the letters in a string. Say I have
$str = "cdcdcdcdeeeef";
I can use str_split and array_count_values to achieve this.
array_count_values(...
7
Solved
I want to scan my Android project for all hardcoded Strings so I can localize the project, putting the Strings in strings.xml. I see an option in Eclipse to 'Externalize Strings...' but it isn't sp...
Decommission asked 6/11, 2011 at 3:15
14
Solved
I have an integer that was generated from an android.graphics.Color.
It has a value of -16776961. How do I convert it into a hex string with the format #RRGGBB?
Simply put: I would like to output #...
5
Solved
I found a Windows API function that performs "natural comparison" of strings. It is defined as follows:
int StrCmpLogicalW(
LPCWSTR psz1,
LPCWSTR psz2
);
To use it in Delphi, I declared it thi...
Martin asked 21/6, 2009 at 18:50
© 2022 - 2024 — McMap. All rights reserved.