string Questions
7
Solved
When I create template literals, I would use the trim() to remove extra space. But I noticed when I do this inside a JS function, it still creates extra tabs or white space.
function BottlesOf...
Subsidence asked 6/12, 2021 at 23:49
28
Solved
How can I convert a string either like 'helloThere' or 'HelloThere' to 'Hello There' in JavaScript?
Banda asked 29/8, 2011 at 2:3
6
I'm fairly new to JS, and realize length is considered a property. But I received a comment to not use str.length in a loop:
for (i=0; i<str.length; i++){...}
vs
var len = str.length;
for (i=...
Polysyllable asked 18/6, 2015 at 21:19
4
Solved
PHP supports variable interpolation in double quoted strings, for example,
$s = "foo $bar";
But is it possible to interpolate function call results in the double quoted string?
For example,
$s...
Converse asked 25/5, 2012 at 17:1
9
Solved
I'm trying to split strings in half, and it should not split in the middle of a word.
So far I came up with the following which is 99% working :
$text = "The Quick : Brown Fox Jumped Over The Laz...
5
Solved
Given pairs of string like this.
my $s1 = "ACTGGA";
my $s2 = "AGTG-A";
# Note the string can be longer than this.
I would like to find position and character in in $s1 where it differs with...
5
Solved
I'm working on a project where I have to read a date to make sure that it's a valid date. For example, February 29th is only a valid date on leap years, or June 31st is not a valid date, so the com...
Taper asked 20/10, 2013 at 20:18
10
Solved
I'm pretty new to Python and am completely confused by .join() which I have read is the preferred method for concatenating strings.
I tried:
strid = repr(595)
print array.array('c', random.sample...
21
Solved
I want JavaScript to translate text in a textarea into binary code.
For example, if a user types in "TEST" into the textarea, the value "01010100 01000101 01010011 01010100" sho...
Umbilicate asked 20/1, 2013 at 23:36
5
Solved
Google text-to-speech (TTS) has a 5000 character limit, while my text is about 50k characters. I need to chunk the string based on a given limit without cutting off the words.
“Well, Prince, so Gen...
18
Solved
I have been storing phone numbers as longs and I would like to simply add hyphens when printing the phone number as a string.
I tried using DecimalFormat but that doesn't like the hyphen. Probably...
Pacemaker asked 25/2, 2011 at 7:38
3
I'm new in C# and need to read float values (x, y, z) from file.
It looks like:
0 -0.01 -0.002
0.000833333333333 -0.01 -0.002
If Iam trying
float number = float.Parse("0,54"); // it wor...
Miranda asked 31/12, 2014 at 13:48
8
Solved
Is there a simple way to check how many times a character appears in a String?
Binomial asked 25/5, 2010 at 9:46
14
Solved
What regex pattern would need I to pass to java.lang.String.split() to split a String into an Array of substrings using all whitespace characters (' ', '\t', '\n', etc.) as delimiters?
Ostler asked 22/10, 2008 at 11:27
10
Solved
I'm preparing for a quiz, and I have a strong suspicion I may be tasked with implementing such a function. Basically, given an IP address in network notation, how can we get that from a 32 bit inte...
Hertzog asked 5/11, 2009 at 12:49
4
My bash script receives a filename (or relative path) as a string, but must then read from that file. I can only read from a filename if I declare it as a literal directly in the script (without qu...
6
Solved
How can I convert a mixed case string to a lowercase string in C?
3
I want to convert string to double.
Here's example of what I do :
string line = "4.1;4.0;4.0;3.8;4.0;4.3;4.2;4.0;";
double[] values = line2.Split(';').Select(double.Parse).ToArray();
But an ...
3
Given a vector of strings texts and a vector of patterns patterns, I want to find any matching pattern for each text.
For small datasets, this can be easily done in R with grepl:
patterns = c("so...
Olympian asked 17/6, 2014 at 7:18
3
Solved
I have a string
vec = c('blue','red','flower','bee')
I want to convert different strings into the same in one line instead of seperately
i.e. i could gsub blue and gsub red to make them both spe...
6
Solved
For Example I have this string
http://www.merriam-webster.com/dictionary/sample
What I want is to return only merriam-webster.com I'm planning to use .Replace() but I think there are better app...
13
Solved
JavaScript Split,
str = '123.2345.34' ,
expected output 123.2345 and 34
Str = 123,23.34.23
expected output 123,23.34 and 23
Goal : JS function to Split a string based on dot(from last) in O(...
Bethanybethe asked 23/4, 2015 at 13:48
3
Solved
Suppose I'm supplied with a String which is like "$123,456,56.25" or "123'456.67" or something similar to this (with digits and a decimal point and some seperator like , or ' or something else whic...
Clam asked 16/5, 2011 at 11:10
7
Solved
If I have a string "key:<String || UUID>" is there a way where I can extract the string and differentiate of the part after : is a string or a UUID?
Example: in this key:863864947148451183L ...
16
Solved
I have an array like this:
$sports = array(
'Softball - Counties',
'Softball - Eastern',
'Softball - North Harbour',
'Softball - South',
'Softball - Western'
);
I would like to find the longest co...
© 2022 - 2024 — McMap. All rights reserved.