string

Trying to split by two delimiters and it doesn't work - C

Hi All, I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago\n and then split each line by ';' delimiter and print each record. Then in yet another loop I try to split the record by '=' delimiter to get to the actual values. But for some reason then the main (first) loop doesn't loop beyond ...

Case Insensitive comparision of strings in Shell script

The == is used to compare two string in shell script, however I want to compare two strings by ignoring case, how it can be done.Do we any standard command for this. ...

How can I invert the case of a String in Java?

I want to change a String so that all the uppercase characters become lowercase, and all the lower case characters become uppercase. Number characters are just ignored. so "AbCdE123" becomes "aBcDe123" I guess there must be a way to iterate through the String and flip each character, or perhaps some regular expression that could do it....

WCF String DataMemeber fails with special characters.

Hi guys, I have a simple DataContract structured in this way: [DataMember(EmitDefaultValue = false, IsRequired = true, Name = "TablePath", Order = 1)] public string TablePath { get; set; } The Value that I try to insert is something like that: %PATH%\%SPECIAL%\file.txt And I receive this message using the WCF Test Client UI...

writing out a null in javascript

This question is in follow up to this one: write binary data using JavaScript on the server. The problem there with just using Response.Write to write the string is that the string contains a null character which JavaScript recognizes as the end of the string. The string I'm trying to write starts with the following (written here in...

Non-exponential formatted float

Hello, I have a UTF-8 formatted data file that contains thousands of floating point numbers. At the time it was designed the developers decided to omit the 'e' in the exponential notation to save space. Therefore the data looks like: 1.85783+16 0.000000+0 1.900000+6-3.855418-4 1.958263+6 7.836995-4 -2.000000+6 9.903130-4 2.100000+6...

Checking string for whitespace

Is there a way I can check for whitespace?For example, I DO NOT want to check for whitespace such as this... $string = "The dog ran away!"; and have it output Thedogranaway! I want to check if there if the entry is ALL whitespace and whitespace only? and have it output the error! Basically, I don't want to be able to enter all whit...

MySQL - length() vs char_length()

What's the main difference between length() and char_length()? I believe it has something to do with binary and non-binary strings. Is there any practical reason to store strings as binary? mysql> select length('MySQL'), char_length('MySQL'); +-----------------+----------------------+ | length('MySQL') | char_length('MySQL') | +------...

C++ string question

Hi, I got a really simple question. string str; cin >> str; cout << str; if I type in "Hello World" the output I get is only "Hello". I know it probably has to do with whitespace. So my question is how I should write if I want the whitespace as well? I have also tried to use getline(cin, str); but it will only read input first time a...

Switch Statement with Strings C#

I need to write something that will get the start-up arguments and then do something for those start-up args, and I was thinking that switch would be good but it only accepts for ints and it has to be for a string This isn't the actual code but I want to know how to make something like this work namespace Simtho { class Program ...

PHP preg_replace text variable

I want to echo a string with the variable inside including the ($) like so: echo "$string"; I dont want it to echo the variable for string, I want it to echo '$string' itself, and not the contents of a variable. I know I can do this by adding a '\' in front of the ($), but I want to use preg_replace to do it. I tried this and it doesn...

C++ string manipulation / input

This is for homework! But I need help anyway. The assignment is to input a sentence then output the number of words, and the number of occurrences of each letter. The output must have the letters in alphabetical order. So far, I've been able to count the number of words and get all the letters to lower case so that I'll be able to keep c...

how to get database of all people's names (or at least English common ones)?

Hi, I'm designing an application that need to extract people's names from short texts. What is the best way to do that? is there a database of names where I can test to know where is the name? the fact that the text is short it might not be as intensive in terms of processing needs. Any ideas? Thanks, Tam ...

What's the best way to reset a char[] in C?

I use a string: char word[100]; I add some chars to each position starting at 0. But then I need be able to clear all those positions so that I can start add new characters starting at 0. If I don't do that then if the second string is shorten then the first one I end up having extra characters from the first string when adding th...

Cache And Compare Files In C#

Ok, I'm trying to make an application for an online Radio Station. I have it set to read the song title and artist and write it to a text file on the webserver. I want to have the application store the text in a string or a cache, and then reread it every 15 seconds and if it isn't the same then update the info box. Where the text is ...

Checking a string against a pattern

I want to check posted content against a pattern. I am having trouble setting up this preg_match (or array?). The pattern being... TEXTHERE:TEXTHERE TEST:TEST FILE:FILE AND TEXTHERE:TEXTHERE TEST:TEST FILE:FILE I want to check for either pattern, the one with the whitespace and the one with the line break. If the posted content is...

C++ How to read two lines from string to separate strings?

I got a string foo with 2 lines: string foo = "abc \n def"; How I can read this 2 lines from string foo: first line to string a1 and 2th line to string a2? I need in finish: string a1 = "abc"; string a2 = "def"; ...

What does 'y' in the output stand for in C?

Hi All, I have a problem, I construct a string in a loop and the output of that string to stout displays the string and a character 'y' with two dots above it as the last character. What is that? I create the string in this function: char get_string(char *buf, int ble, FILE *fp, char del) { int i = 0; int c; char result;...

Convert typed-in Text to lowercase

I've got an index.jsp with [snip] <% String name = request.getParameter("name"); String pass = request.getParameter("pass"); String globalname = "webeng"; String globalpass = "2009"; if (name !=null && pass!=null && name.equals(globalname) && pass.equals(globalpass)) { %> <hr /> <p><b>Howdy, <%= request.getPara...

Count the number of occurences of letters in a Python string

So I got a DNA sequence. ACCAGAGCGGCACAGCAGCGACATCAGCACTAGCACTAGCATCAGCATCAGCATCAGC CTACATCATCACAGCAGCATCAGCATCGACATCAGCATCAGCATCAGCATCGACGACT ACACCCCCCCCGGTGTGTGTGGGGGGTTAAAAATGATGAGTGATGAGTGAGTTGTGTG CTACATCATCACAGCAGCATCAGCATCGACATCAGCATCAGCATCAGCATCGACGACT TTCTATCATCATTCGGCGGGGGGATATATTATAGCGCGCGATTATTGCGCAGTCTACG TCATCGACTACGATCAGC...