string

Replace whitespaces using PHP preg_replace function ignoring quoted strings

Look at the following string: SELECT column1 , column2, column3 FROM table1 WHERE column1 = 'text, "FROM" \'from\\\' x' AND column2 = "sample text 'where' \"where\\\" " AND ( column3 = 5 ) I need to escape unnecessary white space characters from the string like: removing white space from beginning and ending ...

string splitting based on char number

string data = "0000062456" how to split this string on 5 pieces so that I have: part[0] = "00"; part[1] = "00"; part[2] = "06"; part[3] = "24"; part[4] = "56"; ...

wchar to char in c++

I have a Windows CE console application that's entry point looks like this int _tmain(int argc, _TCHAR* argv[]) I want to check the contents of argv[1] for "-s" convert argv[2] into an integer. I am having trouble narrowing the arguments or accessing them to test. I initially tried the following with little success if (argv[1] ==...

broken UTF-8 String ruby

While reading a file I get broken UTF-8 String error whenever I have the following in my file través if I change it to normal e then it works. Whats the way to fix this? error only happens if I do line.lstrp or any other function. Just printing the lines is ok. problem even happens when I try to match the string with regex. ...

Strings wont combine - Objective C

Ik have the following strings in the .H file, and i want them to merge into one string at the end of the app when the have collected their data. It wont work, why not and how must i do it correct so the data collected in these strings will be merged into one string ?? NSString *dataHML; NSString *dataHML2; NSString *dataHML3; NSString...

Pass string from tableviewcontroller to viewcontroller in navigation stack

How should I pass a string to the view controller that gets pushed when a tableviewcell is selected. Should I create a custom init method in the view controller? eg [[myvc alloc]initWithURL:...] Set a property? eg [myvc setURL:...] or myvc.url = ... or just create a custom method? [myvc setLoadingURL:...] ...

How do I pass a string or data object between two view controllers?

In my last question i asked how to best send a string from one view controller to another, both which were on a navigation stack: http://stackoverflow.com/questions/2898860/pass-string-from-tableviewcontroller-to-viewcontroller-in-navigation-stack However I just realised I can either pass the path to the file in the app's document's fol...

How do I increment a variable to the next or previous letter in the alphabet in Java?

I'm relatively new to Java coding, and was looking for some help. I have a capital letter defined in a variable string, and I want to output the next and previous letters in the alphabet. For example, if the variable was equal to C, I would want to output B and D. Thanks in advance for any help. ...

PHP String Encoding Error

I'm trying to get the following code to output an IMG tag with the URL for Google Static Maps API http://code.google.com/apis/maps/documentation/staticmaps/#Imagesizes embedded in there... the result is that everything except the $address is being output successfully... what am I doing wrong? function event_map_img($echo = true){ gl...

calculate number of repetition of character in string in c#

how can I calculate the number of repetition of character in string in c# ? example I have sasysays number of repetition of character 's' is 4 ...

Best practice for string substition with gettext using Python

Looking for best practice advice on what string substitution technique to use when using gettext(). Or do all techniques apply equally? I can think of at least 3 string techniques: 1) Classic "%" based formatting: "My name is %(name)s" % locals() 2) .format() based formatting: "My name is {name}".format( locals() ) 3) string.Templa...

[AS 3.0] How to use the string.match method to find multiple occurrences of the same word in a string?

In Actionscript and Adobe Flex, I'm using a pattern and regexp (with the global flag) with the string.match method and it works how I'd like except when the match returns multiple occurrences of the same word in the text. In that case, all the matches for that word point only to the index for the first occurrence of that word. For exam...

How to get the substring in C#?

Hi, I can get the first three characters with the function below. However, how can I get the output of the last five characters (Three) with Substring() function. Or other string function will be used? Thank you. static void Main() { string input = "OneTwoThree"; // Get first three characters ...

What is String Local Memory in Java ?

In a JVM the memory is split into Method Area ,Stack ,Heap , Temp and Registry . what is String Local Memory ? Does this exists ? If so when does it gets allocated or assigned ? Appropriate Usage of this ? Thanks ...

string categorization strategies

I'm the one-man dev team on a fledgling military history website. One aspect of the site is a catalog of ~1,200 individual battles, including the nations & formations (regiments, divisions, etc) which took part. The formation information (as well as the other battle info) was manually imported from a series of books by a 10-man voluntee...

Javascript: How many times a character occurs in a string

Hi all Is there a simple way to chack how many times a character appears in a String? Thanks in Advance Ruth ...

Accessing object property as string and setting its value

Hello there, I have an object in csharp from the class Account each account have a owner, reference, etc. One way I can access an accounts properties is through accessors like account.Reference; but I would like to be able to access it using dynamic string selectors like: account["PropertyName"]; just like in javascript. so I wou...

How can I internationalize strings representing C# enum values?

I've seen many questions and answers about mapping strings to enums and vice-versa, but how can I map a series of localized strings to enums? Should I just create an extension method like this that returns the proper string from a resource file? Is there a way to localize attributes (like "Description") that are used in solutions like ...

Visual Studio does not flag unterminated string constant in VB.Net

I noticed that if I leave off the terminating double quote for a string constant in Visual Studio 2010, there is no error or even a warning, i.e. Dim foo as String = "hi However, the continuous integration tool we are using flags an error: error BC30648: String constants must end with a double quote. What's going on here? Is there...

pgf/tikz: String Symbols as Input Coordinates

Hi all, I'm new to pgf so i was trying out some examples from the pgfplot manual. One example is especially relevant for my current task but, alas, it would not compile. Here is the code: \documentclass[11pt]{article} \usepackage{tikz} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[symbolic x coords={a,...