string

String Manipulation in C Question

Possible Duplicate: Why does simple C code receive segmentation fault? Hey Everyone, I'm sure this is a very basic question, but apparently I'm not quite understanding something here. I've been playing around with C a lot over winter break and just came across something that I thought would work but is giving me a segmentation ...

length and length() in java.

Why do we have length of an array as an attribute. array.length and for String we have a method str.length()? Just came in my mind, is there some reason? ...

cut off empty spaces

Hello everybody! How can i cut off the last empty space? a = ['Hello ','everybody ','! '] for i in range(len(a)): a[i,-1]='' print a ...

Javascript: Process each letter of text

I would like to alert each individual letter of a string, but I am unsure how to do this. So, if I have: var str = 'This is my string'; I would like to be able to separately alert T, h, i, s, etc. This is just the beginning of an idea that I am working on, but I need to know hot to process each letter separately. I am wanting to us...

Delete the \n and following letters in the end of words in a list

How can I delete the \n and the following letters? Thanks a lot. wordlist = ['Schreiben\nEs', 'Schreiben', 'Schreiben\nEventuell', 'Schreiben\nHaruki'] for x in wordlist: ...? ...

Possible to store string and integers in one object

Is it possible to store a string and 11 integers in the same object. Thanks, Alex ...

How to seperate character and number part from string

eg : I would like to seperate OS234 to OS and 234 AA4230 to AA and 4230 I have used following trival soultion ,but I am quite sure that there should be some more efficient and robust solution . private void demo() { string cell="ABCD4321"; int a = getIndexofNumber(cell); string Numberpart = cell.Substring(a, cell...

Using == or Equals for string comparison

In some languages (e.g. C++) you can't use operators like == for string comparisons as that would compare the address of the string object, and not the string itself. However, in C# you can use == to compare strings, and it will actually compare the content of the strings. But there are also string functions to handle such comparisons, s...

How many times a string occurs in another string (textbox) VB.NET

How can I get how many times a string occurs in a textbox? I thought the find function would return the number of times found but it seems to return the location of it. ...

cramming for the exams - what am i missing (C++ string manipulation)

cramming for a c++ exam, on string manip with some example questions (to which i dont have solutions) - below is today's handiwork. although it works fine - would be awesome if any obvious lapses / better way of doing things occur to you, just drop me a quick note, i need to learn me some C++ fast :) thanks! #include <iostream> #includ...

How might I populate an object property using a JSON-encoded server response?

How can i turn this: <? echo json_encode($myArrays); ?> ...into this: _rowData: [ { name: "Most Recent", view: "recentView" }, { name: "Most Popular", view: "popularView" }, { name: "Staff Picks", view: "staffView" } ], My script returns that ^, but i dont know how to put the data into the string, _rowData ? P.S. I am...

How can I guess the encoding of a string in Perl?

I have a Unicode string and dont know what its encoding is. When this string is read by a Perl program, is there a default encoding that Perl will use? If so, how can I find out what it is? I am trying to get rid of non-ASCII characters from the input. I found this on some forum that will do it my $line = encode('ascii', normalize('KD'...

Replace letters in a secret text

Hello! I want to change every letter in a text to after next following letter. But this program doesnt work. Does anyone know why. Thanks in advance. There is also a minor problem with y and z. import string letters = string.ascii_lowercase text=("g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb ...

Getting the first character of a string with $str[0]

I want to get the first letter of a string and I've noticed that $str[0] works great. I am just not sure whether this is 'good practice', as that notation is generally used with arrays. This feature doesn't seem to be very well documented so I'm turning to you guys to tell me if it's all right in all respects to use this notation? Or ...

put <em> and </em> in the beginning and end of each found keywords

im new to preg and wants to find some strings i got in an array and emphasize each one. eg. array[0] = "windows"; array[0] = "windows xp"; text will be: <em>windows</em> is bla bla...<em>windows xp</em> is bla bla how could i do that? ...

Why Doesn't Delphi 2009 Give A Message For A String Constant that is Too Long?

It got me stuck for an hour. I happened to have a string constant with about 280 characters in it. I was trying to use Pos to look for a substring within a long string constant. It gives the result 0 when the string is longer than 255 characters, but gives the correct result when the string is shorter. e.g.: pos('5', '123456789.12345...

python - problem int/string and hash/array

f = open('transaction.log','r') ClerkHash = dict() arr = [0,0] for line in f: Tdate = line[0:12] AccountKey = line[12:50] TransType = line[22:2] ClerkKey = line[24:10] CurrencyCode = line[34:2] Amount = line[36:45] print line print '\n' print AccountKey print '\n' pri...

WPF C# string to decimal, decimal to string problem

Please, help me to identify problem in my C# code(WPF, event-handler): private void Discount5Btn_Click(object sender, RoutedEventArgs e) { decimal catPr; decimal salePr; string catPrStr; catPrStr = PriceCatTBox.Text; catPr = decimal.Parse(catPrStr); salePr = decimal.Multiply(ca...

How I could remove leading zeros in string C# WPF

After I convert a decimal value salePr to string, using following code: decimal salePr; string salePrStr; ... salePrStr = (salePr).ToString("0000.00"); ''' I'd like to get rid of leading zeros (in case result is <1000). What is right and the best way to do this operation? ...

Perform Trim() while using Split()

Hello folks, today I was wondering if there is a better solution perform the following code sample. string keyword = " abc, foo , bar"; string match = "foo"; string[] split= keyword.Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries); foreach(string s in split) { if(s.Trim() == match){// asjdklasd; break;} } I...