Hi,
I'm looking for something that can interpret a string in php and perform simple math calculation, and then return a boolean result as to whether the expression is true or false.
For example:
Sue types in "3*{mysalary}/9=10000"
PHP splits this up into two expressions - explode('=',string);
PHP takes my list of database fields, and...
what are the characters used to separate command-line arguments (such as white space, \t)?
How do you check whether a string contains a separator?
for example: Check("abcd") is false and Check("ab cd") or Check("ab\tcd") is true
...
Hi,
I've got two files,file a around 5mb, and file b around 66 mb. I need to find out if there's any occurnaces of the lines in file a, inside file b, and if so write them to file c.
This is the way I'm currently handling it:
ini_set("memory_limit","1000M");
set_time_limit(0);
$small_list=file("a.csv");
$big_list=file_get_contents("b.c...
hey
okay so lets say $word = [email protected]
can i make a new variable only everything upto the "@"
and another everything after?
( I.E. $one = abcdefg & $two = hijk.lmn )
thanks alot
...
hi all
1---- i'm using java.
which method shoude be used to compare 2 similar strings. if the strings are similar, it return TRUE(ABC is similar to B, B is similar to ABC) .
2-------
how can i get the number of times a string is repeated in an array of strings?
some of The strings are similar (for example person is similar to twolegper...
I'm comparing a string from the database to a list of strings in an array:
if (in_array($entry, array('Söme string', 'other-string')))
This works for other-string, but not for Söme string, the main difference beeing that this string has an umlaut and an html entity in it. If $entry is Söme string in the database, the co...
AFAIK SQLite returns unicode objects for TEXT in Python. Is it possible to get SQLite to return string objects instead?
...
Array(
[1] => put returns (between) paragraphs
[2] => (for) linebreak (add) 2 spaces at end
[3] => indent code by 4 (spaces!)
[4] => to make links
)
Want to get text inside brackets (for each value):
take only first match
remove this match from the value
write all matches to new array
After function arrays should look like:
Array(...
>>> teststring = 'aõ'
>>> type(teststring)
<type 'str'>
>>> teststring
'a\xf5'
>>> print teststring
aõ
>>> teststring.decode("ascii", "ignore")
u'a'
>>> teststring.decode("ascii", "ignore").encode("ascii")
'a'
which is what i really wanted it to store internally as i remove non-ascii characters. Why did the decode("ascii give out a uni...
Is there a simple way to strip padding, IE leading and/or trailing white space. EXSLT padding function seems to only create padding or trim strings to a certain length.
...
Hi
I have a string like this
>>> x="Alpha_beta_Gamma"
>>> words = [y for y in x.split('_')]
>>> words
['Alpha', 'beta', 'Gamma']
I want output saying X is non conformant as the the second element of the list words starts with a lower case and if the string x = "Alpha_Beta_Gamma" then it should print string is conformant
...
Hi,
As the following code is possible in C#, I am intersted whether string is actually an array of chars:
string a="TEST";
char C=a[0]; // will be T
...
I want to send chinese characters to be translated by an online service, and have the resulting english string returned.
I'm using simple json and urllib for this.
And yes, i am declaring.
# -*- coding: utf-8 -*-
on top of my code.
The thing is, now everything works fine if i feed urllib a string type object, even if that object c...
I have a long string (8000 characters) that should contain only hexadecimal and newline characters.
What is the best way to validate / verify that the string does not contain invalid characters?
Valid characters are: 0 through 9 and A through F. Newlines should be acceptable.
I began with this code, but it does not work properly (i.e....
Is there a reason for this? I am asking this because if you needed to use lots of empty char, then you get into the same situation as you would when you use lots of empty strings.
EDIT: Reason for this usage was this:
myString.Replace ('c', '')
So remove all instances of 'c's from myString.
...
I was asked this during an interview and apparently it's an easy question but it wasn't and still isn't obvious to me.
Given a string, count all the words in it. Doesn't matter if they are repeated. Just the total count like in a text files word count. Words are anything separated by a space and punctuation doesn't matter, as long as it...
I want to use a words like, let's say, 'A', 'B' and 'C' on X-axis to show their corresponding properties on Y-axis. How can I write these strings on X-axis instead of numerical data?
...
What is the best way to format the following number that is given to me as a String?
String number = "1000500000.574" //assume my value will always be a String
I want this to be a String with the value: 1,000,500,000.57
How can I format it as such?
...
All,
I am trying to inject a long text entry into a SQLite database, in a TEXT field. This text has new lines in it (i.e. it spans multiple paragraphs).
I can get the new lines to show up if I do the INSERT manually:
INSERT INTO "LOGENTRY" VALUES(5,40,'PLACE','line1
line2
line4
',1283990533315,'4A','TEXT','',NULL);
but if I have ...
Hi,
I am trying to understand an other magic thing about django: it can convert strings to modules.
In settings.py, INSTALLED_APPS is declared like that:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
)
All it contains is strings. But django will convert those strings to...