Hello,
I am new to ruby and currently trying to operate on each character separately from a base String in ruby. I am using ruby 1.8.6 and would like to do something like:
"ABCDEFG".each_char do|i|
puts i
end
This produces a undefined method `each_char' error.
I was expecting to see a vertical output of:
A
B
C
D
..etc
Is the each...
Hi, I want to split a string in C#.NET that looks like this:
string Letters = "hello";
and put each letter (h, e, l, l, o) into an array or ArrayList. I have no idea what to use as the delimiter in String.Split(delimiter). I can do it if the original string has commas (or anything else):
string Letters = "H,e,l,l,o";
string[] AllLett...
does php include any function like toupper and tolower
I want toupper fuction which convert ABC to abc or Abc to abc
simlary tolower shold convert ABC to abc or Abc to Abc
...
I'm looking to expand on a recent script i've coded using jquery.
I have this following code
<script type='text/javascript'>
added_departments = new Array();
$("#departments_submit").click(function(){
var depo = $("#depo_list").val();
if(jQuery.inArray(depo, added_departments) != -1)
{
return false;
}
else
...
Hi,
I have 2 std::string. I just want to, given the input string:
capitalize every letter
assign the capitalized letter to the output string.
How come this works:
std::string s="hello";
std::string out;
std::transform(s.begin(), s.end(), std::back_inserter(out), std::toupper);
but this doesn't (results in a program crash)?...
I've heard that Perl is the go-to language for string manipulation (and line noise ;). Can someone provide examples and comparisons with other language(s) to show me why?
...
how to split a string in javascript?
example str = "this is part 1 one wall this is part 2 "
now I want to split the str in 2 parts separated by word wall
so I want output to be:
st1 ="this is part 1 "
st2 ="this is part 2 "
...
Hi,
I want to compress/transform a string as new string.
i.e.:
input string:
USERNAME/REGISTERID
output string after compress:
<some-string-in-UTF8-format>
output string after decompress:
USERNAME/REGISTERID
There are some compress or hash method for this transformation?
I prefer some solution using Java or an algorithm with ...
Lets say I have a string:
"(aaa and bbb or (aaa or aaa or bbb))"
**for simplicity sake, this will always be the format of the string, always 3 a's followed by a space or ')' or 3b's followed by a space or ')'.
what would be the best way to replace every occurence of 'aaa' with a '1' and everyoccurrence of 'bbb' with a '0' in C. endin...
I have a string full of html & which reads
Dim strHml as string = "<html><head><title></title></head><body><div class="normal">Dog</div>
<div class="normal">Cat</div><div class="normal">Elephant</div><div class="normal">Giraffe</div><div class="normal"><div><p>Random Div</p></div>Lion</div><div>Wolf</div>
<div>Tiger</div></body></html>...
I need to buff out a line of text with a varying but large number of whitespace. I can figure out a janky way of doing a loop and adding whitespace to $foo, then splicing that into the text, but it is not an elegant solution.
...
Hi all,
seems trivial but give me a hard time:
Does anyone have a hint for me on how to remove control characters like STX
from a php string. I played around with
preg_replace("/[^a-zA-Z0-9 .\-_;!:?äÄöÖüÜß<>='\"]/","",$pString)
but found that it removed way to much. Is there a way to remove only
controll chars?
tia
K
...
Hi, I'm just stuck with a problem (maybe Simple). But I can't figure out how to solve it, maybe someone of you can help me.
I receive as input an string with this format:
D0001001.tiff
And I need to return the next one (given that the next one is the received incremente by factor of one.
Input: D0001001.tiff
Output: D0001002.tiff
No...
I have a requirement to sort some strings that contain data like this:
var strings = new List<string>{"2009 Arrears","2008 Arrears","2008 Arrears Interest","2009 Arrears Interest"};
And they want the results ordered like this:
"2009 Arrears"
"2009 Arrears Interest"
"2008 Arrears"
"2008 Arrears Interest"
It seems like I need to cre...
Could find a similar thing for C here.
I need to break a sentence into a an char array based on occurrence of a character example: %
Example
If my sentance is my%healthy%dog then i should be able to get my, healthy and dog separately.
This could be in a loop as well.
tx
...
Hi!
I have an IP address in char type Like char ip = "192.123.34.134" I want increment the last value (134). Does anyone how should i do it? I think, i should convert it to an integer, and then back, but unfortunately i don't know how? :( I'm using C++.
Please help me!
Thanks, kampi
...
Hi guys,
In PHP the trim function has a parameter for trimming specific characters (handy for leading zeros and the like). I can't seem to get it to accept a vertical bar (|) character. Anyone know how to get this working? I tried the hex value but had no luck. I'm sure it's something simple.
Cheers
...
Hi all,
This is partially a theoretical question:
I have a string (say UTF-8), and I need to modify it so that each character (not byte) becomes 2 characters, for instance:
"Nissim" becomes "N-i-s-s-i-m-"
"01234" becomes "0a1b2c3d4e"
and so on.
I would suspect that naive concatenation in a loop would be too expensive (it IS the bo...
Trying to copy a char *str to char c[] but getting segmentation fault or invalid initializer error.
Why is this code is giving me a seg fault?
char *token = "some random string";
char c[80];
strcpy( c, token);
strncpy(c, token, sizeof c - 1);
c[79] = '\0';
char *broken = strtok(c, "#");
...
I am trying to use strtok() in nested loop. But this is not giving me desired results.
Possibly because they are using same memory location. My code is of the form:-
char *token1 = strtok(Str1, "%");
while(token1 != NULL )
{
char *token2 = strtok(Str2, "%");
while(token2 != NULL )
{
//DO SMTHING
token2 = strtok(NULL, ...