string

Is regex too slow? Real life examples where simple non-regex alternative is better

I've seen people here made comments like "regex is too slow!", or "why would you do something so simple using regex!" (and then present a 10+ lines alternative instead), etc. I haven't really used regex in industrial setting, so I'm curious if there are applications where regex is demonstratably just too slow, AND where a simple non-reg...

string.split method in ruby behaves funny to me

txt = "1aaa5" Then txt.split("a") produces [1, "", "", 5] in ruby 1.9. Anyone can explain why? Particularly, why not [1, 5]? Thanks. ...

Regex to Exclude Double spaces

Hi, I am looking for a regular expression for c# asp.net 3.5 that will fail if there are ever any double spaces in a sentence or group of words. the cat chased the dog = true the cat chased the dog = false (doubles spaces occur at random intervals) thanks ...

what does it mean to be "terminated by a zero"

I am getting into C/C++ and alot of terms are popping up unfamiliar to me. one of them is a varible or pointer that is terminated by a zero. What does it mean for a space in memory to be terminated by a zero. I am not sure if I am saying it correctly, if not then please correct me. Thanks! ...

jQuery replace text between parentheses

Hi, I have a requirement to replace the text between () in a string. ...

shuffle string in python

I am looking for a function or short program that recieves a string (up to 10 letters) and shuffles it. thanks Ariel ...

Ignoring characters in a file while parsing

i need to parse through a text file and process the data. the valid data is usually denoted by either a timestamp with TS followed by 10 numbers (TS1040501134) or values with a alpabet followed by nine numbers (A098098098)...so it will be like TS1040501134A111111111B222222222...........TS1020304050A000000000........ However, there are c...

Call load using a div id that has been passed into a function, div id is a parameter

I am dynamically creating divs within a jquery accordion that are loaded with data as when the user clicks on the accordion title. I have this all working except that when I pass the div id into the load details method, the call to .load() does not work. What can I do to fix this? It seems like a simple javascript string eval would work ...

Is it safe to use random Unicode for complex delimiter sequences in strings?

Question: In terms of program stability and ensuring that the system will actually operate, how safe is it to use chars like ¦, § or ‡ for complex delimiter sequences in strings? Can I reliable believe that I won't run into any issues in a program reading these incorrectly? I am working in a system, using C# code, in which I have to s...

Strlen of MAX 16 chars string using bitwise operators

The challenge is to find the fastest way to determine in C/C++ the length of a c-string using bitwise operations in C. char thestring[16]; The c-string has a max size of 16 chars and is inside a buffer If the string is equal to 16 chars doesn't have the null byte at the end. I am sure can be done but didn't got it right yet. I am wo...

How to parse user input from a textarea line by line

If I have a variable that contains text information (say taken from a textarea), how can I read the text content held in a string variable line by line? The text entered in the text area will have \n (enter key) to separate the line. ...

non contiguous String object C#.net

By what i understand String and StringBuilder objects both allocate contiguous memory underneath. My program runs for days buffering several output in a String object. This sometimes cause outofmemoryexception which i think is because of non availability of contiguous memory. my string size can go upto 100MBs and i m concatenating new s...

Marshal managed string[] to unmanaged char**

This is my c++ struct (Use Multi-Byte Character Set) typedef struct hookCONFIG { int threadId; HWND destination; const char** gameApps; const char** profilePaths; } HOOKCONFIG; And .Net struct [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct HOOKCONFIG { public int threadId; public ...

string replace in file using C

I haven't yet implemented this, I'm still in the thinking stage, but I have to go through a file and replace a certain string with another string. For example, <img src="/images/logo.gif" ... should become <img src="/proxy/www.example.com/images/logo.gif" ... Any advice on how I can approach this? Perhaps there exist some "string r...

MySQL: Difference between ', `, ´ and "

When seeing SQL code on the internet and in manuals there seems to vary a lot what is used to signify strings (or at least that's what I think they do?). Are there any difference between using `, ´, ' or "? Are they all the same? Or do some of them have special meanings? Should some be used in certain cases and others in other cases? Wh...

Unusual conversion error (string to integer) asp.net

I have my repeater item template: <asp:Repeater ID="Linksrepeater" runat="server"> <HeaderTemplate><h2>Links</h2><ul> </HeaderTemplate> <ItemTemplate> <li><%#Container.DataItem("Category")%></li> </ItemTemplate> <FooterTemplate> </ul> </FooterTemplate> </asp:Repeater> Hooked up to: s = "sql" x = New SqlCommand(s, c) ...

Most efficient way to get next letter in the alphabet using PHP

Given any character from a to z, what is the most efficient way to get the next letter in the alphabet using PHP? ...

get all words using java

I want to know how to get all word using java String first[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}; String second[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}; String ch =""; String total[]; for(int i = 0...

String replace for personalize code generator

I must do a automatic codes generator with user-configurable string with predefined keys and can not find a good way to do it. For example, a string OT-{CustomCode}-{Date}-{##} could generate codes OT-C0001-20100420-01 OT-C0001-20100420-02 I thought of using RegExpr.Replace(), but I would have problems if the code of a customer wa...

Java equivalent of C#'s verbatim strings with @

Hi all, Quick question. Is there an equivalent of @ as applied to strings in Java: For example I can do @"c:\afolder\afile" in C# and have it ignore the escape characters when processing instead of having to do "c:\\afolder\\aFile". Is there a Java equivalent? hmmm: stackoverflow is escaping on me .. lol. The second example should rea...