function gen_slug($str){
# special accents
$a = array('À','Á','Â','Ã','Ä','Å','Æ','Ç','È','É','Ê','Ë','Ì','Í','Î','Ï','Ð','Ñ','Ò','Ó','Ô','Õ','Ö','Ø','Ù','Ú','Û','Ü','Ý','ß','à','á','â','ã','ä','å','æ','ç','è','é','ê','ë','ì','í','î','ï','ñ','ò','ó','ô','õ','ö','ø','ù','ú','û','ü','ý','ÿ','A','a','A','a','A','a','C','c','C','c','...
I want to put space between punctuations and other words in a sentence. But boost::regex_replace() replaces the punctuation with space, and I want to keep a punctuation in the sentence!
for example in this code the output should be "Hello . hi , "
regex e1("[.,]");
std::basic_string<char> str = "Hello.hi,";
std::basic_string<char> fmt ...
I've spent half day trying to figure out this and finally I got working solution.
However, I feel like this can be done in simpler way.
I think this code is not really readable.
Problem: Find first non-repetitive character from a string.
$string = "abbcabz"
In this case, the function should output "c".
The reason I use concatenation ...
Hi, im just writing my own replace method for any weird characters and i used the ASCI value 0, null to replace unwanted characters, i was hoping for them to be 'deleted', but this doesnt work. A gap just appears in the string.
What exactly does String.Replace() do when removing a character for ""? Does it shift them all down and then '...
Hi All,
i have a string say "31-02-2010" now i want to check that wheather this date is valid date or not .
what is the best way to do it?
so i need a method which i operate on string which returns true if date is valid and false if it's invalid.
...
Possible Duplicate:
What is the purpose of the expression new String() in Java?
Hi,
1) What is difference in thers two statements:
String s1 = "abc";
and
String s1 = new String("abc")
2) as i am not using new in first statement, how string object will be created
Thanks
...
I am close but I am not sure what to do with the restuling match object. If I do
p = re.search('[/@.* /]', str)
I'll get any words that start with @ and end up with a space. This is what I want. However this returns a Match object that I dont' know what to do with. What's the most computationally efficient way of finding and returnin...
I have a TextArea with enter seperated values:
For Example:
Value1
Value2
Value3
Value4
Value5
Is there a fast way to put them in a String array
String[] newStringArray = ???
...
Consider the following code
public static void method(String[] srgs){
try{
}catch(){
System.out.println("Hello World" + "one");}
catch(..){
System.out.println("Hello World" + "two");}
catch(..){
System.out.println(getString());}
}
When are these Strings created? I assume the Strings will get created when an Exception occ...
I making a method that generate a unique string key for some parameters. But the same key if call with same values.
I just accept primitive types, string, DateTime, Guid, and Nullable(since I append types together, I can distinguish who is int and who is int?), because I can convert all to string without lost values or precision.(for fl...
I have a PHP variable which contains information about color. For example $text_color = "ff90f3". Now I want to give this color to imagecolorallocate. The imagecolorallocate works like that:
imagecolorallocate($im, 0xFF, 0xFF, 0xFF);
So, I am trying to do the following:
$r_bg = bin2hex("0x".substr($text_color,0,2));
$g_bg = bin2hex("0...
I tried parsing a number with .NET Int64.Parse method, and it won't accept a string like "0x3039", even though that's how you write the constant in C#. The documentation specifically disallows the string to have a "0x" prefix, and a trailing "h" doesn't seem to work either.
To parse a hexadecimal number, I must have to use the System.G...
I found this example on stack overflow. I understand it, but seems like a bit much for such a simple method concept... removing several chars from a string.
import string
exclude = set(string.punctuation)
s = ''.join(ch for ch in s if ch not in exclude)
is there a builtin string method in python 3.1 to do something to the tune of:
...
I'm looking for a function to convert a string to the xml string with xml entities where needed. Something like htmlentities in PHP but for XML and in Javascript.
Thank you for any help!
...
i use nicEdit to write RTF data in my CMS. The problem is that it generates strings like this:
hello first line<br><br />this is a second line<br />this is a 3rd line
since this is for a news site, i much prefer the final html to be like this:
<p>hello first line</p><p>this is a second line<br />this is a 3rd line</p>
so my current...
Hi All,
I have a VB6 application that has been performing very well. Recently, we upgraded our server to a Windows 2003 server. Migration of the databases and shares went well and we experienced no problems. Except one. And it has happened at multiple sites.
I use the MySQL ODBC 5.1 connector to point to my MySQL database. On identical...
I need to split a string (in Java) into individual words ... but I need to preserve spaces.
An example of the text I need to split is something like this:
ABC . . . . DEF . . . . GHI
I need to see "ABC", " . . . .", "DEF", ". . . .", and "GHI".
Obviously splitting on the space character \s isn't going to work, as all the spaces g...
How can I replace a string with another string, within a given text file. Do I just loop through readline() and run the replacement while saving out to a new file? Or is there a better way?
I'm thinking that I could read the whole thing into memory, but I'm looking for a more elegant solution...
Thanks in advance
...
Hi, I would like to construct a hash table that looks up keys in sequences (strings) of bytes ranging from 1 to 15 bytes.
I would like to store an integer value, so I imagine an array for hashing would suffice. I'm having difficulty conceptualizing how to construct a hash function such that given the key would give an index into the ar...
How do perl strings represented internally? What encoding is used? How do I handle different encodings properly?
I've been using perl for quite a long time, but it didn't include a lot of string handling in different encodings, and when I encountered a minor problem that had something to do with encodings I usually resorted to some sham...