string

how do convert string to byte[] in C#

How do you get a byte array out of a string in C#? I would like to pass a string to this method. ...

jQuery: Convert TextArea content to html string and vice versa

Hello everyone, what I'm trying to do is converting a TextArea content into a valid html code. Suppose you type inside the TextArea and then you press a button that shows the typed text inside a element. If you typed something like inside the TextArea: Hi folks! Do you like jQuery? I do! The resulting string you have to put ins...

What's the quickest way to compare strings in Java?

What's the quickest to compare two strings in Java? Is there something faster than equals? EDIT: I can not help much to clarify the problem. I have two String which are sorted alphabetically and EXACTLY the same size Example: abbcee and abcdee Strings can be long up to 30 characters ...

Replace string within a array

NSArray *ArtistNames = [RawData componentsMatchedByRegex:regEx1]; NSCharacterSet *doNotWant = [NSCharacterSet characterSetWithCharactersInString:@"'"]; ArtistNames = [[ArtistNames componentsSeparatedByCharactersInSet: doNotWant] componentsJoinedByString: @"'"]; Thats my code at the moment basically i cannot use it as A...

How Parsing string between [STX] and [ETX] using C# - Split/Append output using Regex or String Functions

Language = C#.NET Anything that is between [STX] and [ETX] must be accepted rest of the things must be rejected. string startparam = "[STX]"; string endparam = "[ETX]"; String str1 = "[STX]some string 1[ETX]"; //Option 1 String str2 = "sajksajsk [STX]some string 2 [ETX] saksla"; //Option 2 String str3 = "[ETX] dksldkls [STX]some stri...

String Comparison differences between .NET and T-SQL?

In a test case I've written, the string comparison doesn't appear to work the same way between SQL server / .NET CLR. This C# code: string lesser = "SR2-A1-10-90"; string greater = "SR2-A1-100-10"; Debug.WriteLine(string.Compare("A","B")); Debug.WriteLine(string.Compare(lesser, greater)); Will output: -1 1 This SQL Server code: ...

removing obsolete keys from messages.properties generated by string externalizing

Hi, I am using "Externalize Strings" widget of Eclipse. On externalizing strings, a messages.properties file is generated with key value pairs. Say the messages.properties looks like this: Test_msg1=Add Test_msg2=Remove Test_msg3=Include Say I have a file Test.java with code: String add = Messages.getString("Test_msg1"); String re...

Java Thread , How it comes the answer is A?

The question is from http://www.javacertifications.net/javacert/scjp1.6Mock.jsp Questions no -20 What is the output for the below code ? public class Test extends Thread { static String sName = "good"; public static void main(String argv[]) { Test t = new Test(); t.nameTest(sName); System.out.pr...

coldfusion string comparison

I have a form that returns a list like this when submitted: 2009,9 I want to compare it to database pulled values but keep getting an error. <cfif #FORM.month# eq #qGetDates.year#,#qGetDates.month#> I know I probably have to cast it or convert it to a string for the comparison to work, how do I do this? Thanks, R. ...

How to parse arithmetic operators from string?

Is it possible to assign an int variable a value that is a result of expression written in a string? E.g. I have a string "5 - 3" and the expected result is 2. ...

MeasureString and DrawString difference

Hello, why do i have to increase MeasureString() result width by 21% size.Width = size.Width * 1.21f; to evade Word Wrap in DrawString()? I need a solution to get the exact result. Same font, same stringformat, same text used in both functions. From answer by OP: SizeF size = graphics.MeasureString(element.Currency, Currencyfont...

How to get System.IO.Stream from a String Object

I have string object. I need to pass this data to another object of type XYZ. But this object of type XYZ is taking only System.IO.Stream. So how to convert the string data into a stream so that object of XYZ type can use this string data? ...

Add String to Drupal Translation Server without Resetting

I need to add some strings to my Drupal translation server but I don't want to reset the current translations. Is there any way I can do this? ...

How can I declare an XML string in my Java application?

I'm using kXML in my Blackberry application using Java. I want to create a string that has the xml information I need for testing purposes. Any guidance? For example: String theXML = @" <xml> </xml>"; ...

In python, how to precise a format when converting int to string?

More precisely, I want my format to add leading zeros to have string with constant length. e.g. if the constant length is set to 4 1 would be converted into "0001" 12 would be converted into "0012" 165 would be converted into "0165" I have no constraint on the behaviour when the integer is greater than what can allow the given length (9...

How can I declare a two dimensional string array in C#?

string[][] Tablero = new string[3][3]; I need to have a 3x3 array arrangement to save information to. How do I declare this in C#? ...

How to store binary data in a lua string

I needed to create a custom file format with embedded meta information. Instead of whipping up my own format I decide to just use Lua. texture { format=GL_LUMINANCE_ALPHA; type=GL_UNSIGNED_BYTE; width=256; height=128; pixels=[[ <binary-data-here>]]; } texture is a function that takes a table as it sole argument. It th...

How to detect newline character(s) in string using Visual Studio 6 C++

I have a multi-line ASCII string coming from some (Windows/UNIX/...) system. Now, I know about differences in newline character in Windows and UNIX (CR-LF / LF) and I want to parse this string on both (CR and LF) characters to detect which newline character(s) is used in this string, so I need to know what "\n" in VS6 C++ means. My ques...

Groovy String to Date

I am coding this with Groovy I am currently trying to convert a string that I have to a date without having to do anything too tedious. String theDate = "28/09/2010 16:02:43"; def newdate = new Date().parse("d/M/yyyy H:m:s", theDate) Output: Tue Aug 10 16:02:43 PST 2010 The above code works just fine, however when my string cha...

Is there a simple method of converting an ordinal numeric string to its matching numeric value?

Does anyone know of a method to convert words like "first", "tenth" and "one hundredth" to their numeric equivalent? Samples: "first" -> 1, "second" -> 2, "tenth" -> 10, "hundredth" -> 100 Any algorithm will suffice but I'm writing this in C#. EDIT It ain't pretty and only works with one word at a time but it suits my purposes. Mayb...