I know, Erlang strings should be avoided at all costs...
but if I'm not doing that, how do I produce "5" from 5?
in particular, is there anything like io:format("~p",[5]) that would return a formatted string instead of printing to a stream?
...
How to connect string "Hello" and string "World" to "HelloWorld"? Looks like "+" doesn't work.
...
I'd like to store an additional column in a table as a 'sort value', which is a numeric representation of the title column, such that the order of such values represents the string's natural alphabetical sort order. Ie, so that I can retrieve rows ordered by the sort value, and they'll be in natural sort order - and when I insert a new ...
I received an nsstring from the server. Now I want to split it into the substring I need.
How to split the string?
For example:
substring1:read from the second character to 5th character
substring2:read 10 characters from the 6th character.
...
I want to split a long string received from a server to a few substrings. The separate characters are different.
Are there any sample code for method: componentsSeparatedByCharactersInSet? Or may I ask a simple code to split "A~B^C" to "A", "B" and "C"?
...
Hello
I have a simple python code that searches a files for a string "path=c:\path" ( "c:\path" is the part that can change and returns a text after "path=". Current code sketch is:
def findPath( i_file) :
lines = open( i_file ).readlines()
for line in lines :
if line.startswith( "Path=" ) :
return # what to do here in or...
If I have a string like this:
FOO[BAR]
I need a generic way to get the "BAR" string out of the string so that no matter what string is between the square brackets it would be able to get the string.
e.g.
FOO[DOG] = DOG
FOO[CAT] = CAT
...
Pretty simple question from a first-time Ruby programmer.
How do you loop through a slab of text in Ruby? Everytime a newline is met, I want to re-start the inner-loop.
def parse(input)
...
end
...
I want to add some marks to separate some strings.
How to add a char to a string?
e.g. add '\x01' to "Hello", add '\x02' before "World" and add '\x03' after "World".
So I can create a string "\x01 Hello \x02 World \x03" which has some separate marks.
...
I have a div which collapses clicking on a text header. I want to change the header from "+ filters" to "- filters" accordingly (when the div is collapsed or expanded)
How can I perform this with jQuery:
if (headerDiv.text() starts with "+")
replace "+" with "-"
else
replace "-" with "+"
?
...
I'm writing some code which needs to do string normalisation, I want to turn a given string into a camel-case representation (well, to the best guess at least). Example:
"the quick brown fox" => "TheQuickBrownFox"
"the_quick_brown_fox" => "TheQuickBrownFox"
"123The_quIck bROWN FOX" => "TheQuickBrownFox"
"the_quick brown fox 123" => "The...
I have a string in a loop and for every loop it is filled with texts the looks like this:
"123 hello everybody 4"
"4567 stuff is fun 67"
"12368 more stuff"
I only want to retrieve the first numbers up to the text in the string and I ofcourse do not know the length.
Thanks in advance!
...
Can anyone think of an efficient way (time wise) to trim a few selected characters from the middle of a string?
Best I came up with was:
public static string Trim(this string word, IEnumerable<char> selectedChars)
{
string result = word;
foreach (char c in selectedChars)
result = result.Replace(c.ToString(), "");
re...
How do i look for the following pattern using regular expression in python? for the two cases
Am looking for str2 after the "=" sign
Case 1: str1=str2
Case 2: str1 = str2
please note there can be a space or none between the either side of the "=" sign
Mine is like this, but only works for one of the cases!
m=re.search('(?<=str\s\...
I am building a string in Cocoa to be used as a SQL statement which will be passed into the FMDB wrappers for sqlite; however, the database craps out with a BAD_ACCESS failure. I have the following code:
prefix = @"SELECT * FROM Table WHERE Field1 LIKE '%";
middle = @"%' OR Field2 LIKE '%";
suffix = @"%' ORDERY BY ";
orderby = @"%' ...
Code bellow is not working, any ideas why?
declare @Counter int
set @Counter = 0
declare @ConcText nvarchar(1000)
while @Counter < 5
begin
--set @ConcText = @ConcText + cast(@Counter as nvarchar(10)) + N' counter,'
--set @ConcText = @ConcText + convert(nvarchar(10), @Counter) + N' counter,'
set @ConcText = @ConcText + N' co...
Hi Guys,
Im trying to join a number of elements of an array into a string using this;
$a = "h","e","l","l","o"
$b = [string]::join("", $a[0,1,2,3])
But I get a 'Missing ')' in method call' error. The join documentation only mentions joining all the elements of an array, not elements at specific indexes. Can this be done?
Cheers
And...
I am creating concatenated strings based on the data in each row of my ListView control. I need to figure out how to remove the first element in each string which pertains to a single row of the ListView. How might I accomplish this? This is a C# winforms project.
Here is my current code:
foreach (ListViewItem HazPackE...
Hello,
Is it possible to Build a string or fix the label in the GUI so that I get square meter information to the user. So that the output will look like 21 m2 but the 2 is raised.
Regards
...
I have an third part dll that have a function that returns a string.
When I call the function I got for example "123456" back. At least it seams like that, but when i do mystring.length it does not return any length. If I set the text property of a label it shows "123456".
When I have the string I got from the dll I send it to a webserv...