string

C# string handling how get path and args from a string

I have a string with quotes around the path as follows: "C:\Program Files (x86)\Windows Media Player\wmplayer.exe" arg1 arg2 If I use Text.Split(new Char[] { ' ' }, 2); then I get the first space. How to get the path and args ? ...

Replace text, Jython, Regex

Hey, I am processing my website and wanting to change some things on the pages. I am wanting to replace the following string: in the <SPAN class="Bold"> More... </SPAN> column to your right. Some times is does not have the <span> tags : in the More... column to your right. I would like to replace this with "below". I tried doing...

VB.NET: If I pass a String ByVal into a function but do not change the string, do I have one or two strings in memory?

I know strings are immutable, so the minute you change a string reference's value .NET makes a brand new string on the heap. But what if you don't change the value of a string reference; rather, you simply pass it into a function ByVal -- does this operation copy the string value on the heap as well? My inclination is "no," but I'd l...

Fastest way to compare a string with an array of strings in C#2.0

What is the fastest way to compare a string with an array of strings in C#2.0 ...

DataTable.Select("ColumnName IN ") Guid error

I'm having problems with a DataTable line, the idea is that I want to pull out of a series of rows any rows where one of the column values is in a set of guids. However, I'm getting a guid / string comparison error from the select() function. The code is as follows: Dim sb As New StringBuilder For Each Row As DataRow In dtData.Rows ...

echoing multiple arguments when output_buffering is on

One of Googles Let's make the internet faster talks included something about using echo with multiple arguments in PHP instead of using print or string concatenation. echo 'The ball is ', $color; Rather than either of these echo "The ball is $color"; echo 'The ball is ' . $color; What if output buffering is in play ? What would be...

How do I parse a string using C# and regular expressions?

How do I convert the string: "Microsoft Windows XP Professional x64 Edition|C:\\WINDOWS|\\Device\\Harddisk4\\Partition1" to "Microsoft Windows XP Professional x64 Edition" ...using regular expressions? I want to cut out all after | symbol. Is it easy to realise it via Regex.Replace? Where could I found syntax description for Rege...

Will this leak memory?

Hello. I made a small function to catenate strings and return the combined string. However since I assign memory to a third variable in the function, will the memory be freed when the function finishes or will it stay there, requiring me to free it later? and if I need to free it, what's the most stylish solution to do it? Here's the te...

CocoaTouch : Localized Application Randomly Changing Language

I have followed Apple's documentation on localizing iPhone software, using the genstrings ruby script to create my strings file, and have localized all of my nib files. I also looked on both Apple's message boards, and around the net to try to find the solution. I have made sure that all strings files are UTF-16, and changed my build s...

Activerecord, select on string compare

Hi all, I have a table called Basic , start_time is one field with type :VARCHAR(5), which actually stores a 5 bytes time data: byte 0 and 1 map to the year , month and day, and byte 2 to 4 map to the hour, min and second. So, it could possible bytes 2 ,3 ,4 are all 0. And I want to do following query : Basic.find (:all , :conditions =...

Why is string.contains() returning false?

I have the following string: \\\?\hid#vid_04d8pid_003f#62edf110800000#{4d1e55b2-f16f-11cf-88cb-001111000030} stored in a string variable (from a function call) called devPathName and the following defined: const string myDevice = @"vid_04d8pid_003f"; but the following code always evaluates to false: Boolean test = true; test = devPa...

iPhone: Problems with Formatted String (Objective C)

I need help. How come this does not work: NSProcessInfo *process = [NSProcessInfo processInfo]; NSString *processName = [process processName]; int processId = [process processIdentifier]; NSString *processString = [NSString stringWithFormat:@"Process Name: @% Process ID: %f", processName, processId]; NSLog(processString); But this doe...

How can I get a hex dump of a string in PHP?

I'm investigating encodings in PHP5. Is there some way to get a raw hex dump of a string? i.e. a hex representation of each of the bytes (not characters) in a string? ...

where is lstrncpy's head file?

I know lstrcpy is used for string copy for both unicode and ascii, But I can not use lstrncpy, because I can't find the head file. What is the name of the head file, I googled it, and find someone is using it. Many thanks! ...

Python strings split with multiple separators

Weird - I think what I want to do is a fairly common task but I've found no reference on the web. I have text, with punctuation, and I want an array of the words. i.e - "Hey, you - what are you doing here!?" should be ['hey', 'you', 'what', 'are', 'you', 'doing', 'here']. But python's split() only works with one argument... so I have all...

How can I implement a string data type in LLVM?

I have been looking at LLVM lately, and I find it to be quite an interesting architecture. However, looking through the tutorial and the reference material, I can't see any examples of how I might implement a string data type. There is a lot of documentation about integers, reals, and other number types, and even arrays, functions and ...

converting special characters in php

Hi, I've tried many functions already, but i simply can't figure it out. The right way anyway. in a form field called description, i can expect all kinds of characters. These need to be formatted into html entities before submitted to the db. Now, my code: $formdesc = htmlentities($_POST['formdesc'], ENT_QUOTES); and for mysql quer...

When to use Regex vs Built in String Methods?

I've noticed a lot of little debates about when to use regex and when to use a built in string function like String.Replace() (.NET). It seems a lot of people recommend always, always, always using regex whenever you deal with strings at all (besides just displaying them). Is this really best practice or just a wrong impression on my p...

Compare strings by their written representation - is it possible?

For example I have a column that contains string (in English - "A", "B" ) "AB1234" and I'd like to compare it to the string "AB1234" (in Russian "A", "B" ), for Example. Is there any built-in function to achieve this? The best way I found is to use Translate func where i enumerate all needed symbols. ...

How do I strip a substring given that the total string is too long? (m4)

I have code like this: define(`DOSPACE',`................................... ......................... ................`'ifelse(eval(len(`Space: $2: $3')>60),1,`...'substr($3,eval((60-len(`Space: $2: $3')-7)*-1),$3) ................... ...................') That is, if the total string is too long (over 60 chars), I want to strip off ...