string

String.substring(index) has stoped my thread in debug mode.

Hello! I work with j2me polish 2.0.7, in eclipse 3.4.2, with wtk2.5.2_01. I create control which draws text: normal, bold, and italic. The code below is parsing raw text, and search for * and _ symbols, if found than add to draw vector the text and the drawer, and it's just stops after getting second time to the line 58: String test =...

How to get length of the longest sequence with same characters in a string?

To be specified: function getLength($str) { //function i need } $str1 = 'aabbcccc'; $str2 = 'aabbccccaaaaa'; echo getLength($str1); //will get 4 echo getLength($str2); //will get 5 Any good ideas?Thanks in advance! ...

printf("... %c ...",'\0') and family - what will happen?

How will various functions that take printf format string behave upon encountering the %c format given value of \0/NULL? How should they behave? Is it safe? Is it defined? Is it compiler-specific? e.g. sprintf() - will it crop the result string at the NULL? What length will it return? Will printf() output the whole format string or ju...

Finding unique elements in an string array in C

Hi, C bothers me with its handling of strings. I have a pseudocode like this in my mind: char *data[20]; char *tmp; int i,j; for(i=0;i<20;i++) { tmp = data[i]; for(j=1;j<20;j++) { if(strcmp(tmp,data[j])) //then except the uniqueness, store them in elsewhere } } But when i coded this the results were bad.(I han...

Difference between numeric and string value in PHP

Hi everyone, I am getting a difference when comparing two string which are 0 and '0' in PHP. Can I do anything to make them be compared equally in an if action? Thanks! ...

Create a string with n characters.

Is there a way in java to create a string with a specified number of a specified character? In my case I would need to create a string with 10 spaces. My current code is: StringBuffer outputBuffer = new StringBuffer(length); for (int i = 0; i < length; i++){ outputBuffer.append(" "); } return outputBuffer.toString(); Is there a b...

Why is "#{String}" a common idiom in Ruby

A Ruby dev I know asked this; my answer is below... Are there other, better reasons? Why do so many Ruby programmers do "#{string}" rather than string since the second form is simpler and more efficient? ...

Delphi Unicode String Type Stored Directly at its Address (or "Unicode ShortString")

I want a string type that is Unicode and that stores the string directly at the adress of the variable, as is the case of the (Ansi-only) ShortString type. I mean, if I declare a S: ShortString and let S := 'My String', then, at @S, I will find the length of the string (as one byte, so the string cannot contain more than 255 characters...

C#: Using DateTime.Parse with string

Hi all.I am trying to get date format from Day name and time like "Monday" and second string "08:15" and it must like 10:05:2010 08:15 and then I will make subtracting from date of today. DateTime.Parse("08:15") it works but it outputs today`s date. I want to get date of day name. I also used DateTime.Parse("08:15").AddDays(1...

Labview String output

How do I send a string output from a DAQ Board (NI- USB 6259) using labview? I want to send commands such as " CELL 0" or "READ" to a potentiostat device using labview. Thanks ...

javascript string exec strange behavior

have funciton in my object which is called regularly. parse : function(html) { var regexp = /...some pattern.../ var match = regexp.exec(html); while (match != null) { ... match = regexp.exec(html); } ... var r = /...pattern.../g; var m = r.exec(html); } with unchanged html the m returns...

String Manipulation with Regex.

I will have a different type of string(string will not have fixed format,they will be different every time) from them I want to remove some specific substring.Like the string can be FUTIDX 26FEB2009 NIFTY 0 FUTSTK ONGC 27 Mar 2008 FUTIDX MINIFTY 30 Jul 2009 FUTIDX NIFTY 27 Aug 2009 NIFTY FUT XP: 29/05/2008 I want to remove the string ...

Regex to match with digit in the string.

I will have a different type of string(string will not have fixed format,they will be different every time) from them I want to remove some specific substring.Like the string can be OPTIDX 26FEB2009 NIFTY CE 2500 OPTIDX NIFTY 30 Jul 2009 4600.00 PE OPTSTK ICICIBANK 30 Jul 2009 700.00 PA I want to extract Rs.(digit) from those string a...

sed: search and replace string with line number

Hi volks, I have a XML file with a lot of empty tag attributes. For instance: <mytag id=""> <ontent>aaa</content> </mytag> <mytag id=""> <ontent>bbb</content> </mytag> <mytag id=""> <ontent>ccc</content> </mytag> Now I want to replace id="" with e.g. id="2443" (id="[linenumber]") I tried to do this with sed, but I did not get ...

explain this macro

#define __T(x) L ## x Found in code from one of the MFC source header file. It is mostly used for converting strings to ........ (I don't know what). If I am correct it converts strings to LPCTSTR...don't know what that type is either... I can't seem to convert char* into LPCTSTR. While MFC file handling, the following code will ...

i need help with using string template with .net mvc2, where do i get started?

Hi, I'm trying to try out string template with .net mvc, but i can't find any tutorial that is good for newbies and give me a step for step guidance through how to implement string template with c# and .net mvc2... any help is really very very very very ........ very appreciated Lina ...

Application leaking Strings?

My .net application does some heavy string loading/manipulation and unfortunately the memory consumption keeps rising and rising and when looking at it with a profiler I see alot of unreleased string instances. Now at one point of time or another I do need all objects t hat do have these string fields, but once done, I could get rid of e...

How to convert characters to something like '\x{ff41}' in PHP?

I see some data format like \x{ff41} in my regex patterns. I know how to use it via some examples but don't know what it means in PHP.And now I need to figure out whether a character is included by a sequence with range like \x{FF10}-\x{FF19} .Help would be highly appreciated! ...

Ruby: How to check if a string is a valid time?

I'm pulling data from a feed that I have no control over and I need to verify if a string I'm given is a valid time. Most of the time I'm correctly sent something like "2:35" or "15:41" but other times it's things like "AM" or "PM" (and no numbers)...so I ultimately just need to ignore those. So, how can I verify if the data is a valid...

Does String inherit from Object in Javascript?

Is Object the base class of all objects in Javascript, just like other language such as Java & C#? I tried below code in Firefox with Firebug installed. var t = new Object(); var s1 = new String('str'); var s2 = 'str'; console.log(typeof t); console.log(typeof s1); console.log(typeof s2); The console output is object object string ...