I have a arbitrarily large string of text from the user that needs to be split into 10k chunks (potentially adjustable value) and sent off to another system for processing.
Chunks cannot be longer than 10k (or other arbitrary value)
Text should be broken with natural language context in mind
split on punctuation when possible
split on spaces if no punction exists
break a word as a last resort
I'm trying not to re-invent the wheel with this, any suggestions before I roll this from scratch?
Using C#.
I have a string like this "1 1 3 2 1 1 1 2 1 1 1 1 1 1 1 1,5 0,33 0,66 1 0,33 0,66 1 1 2 1 1 2 1 1 2 0,5 0,66 2 1 2 1 1 1 0 1".
How to add elements to each other in python ?
I've tried :
list = []
for x in str.replace(' ', ''):
list.append(x)
sum = 0
for y in list:
sum = sum + double(x)
but I'm getting errors constantly.
I have a string and i want to find the position of all the occurrences of multiple spaces. Im writing a punctuation checker. I would like to parralelise this operation using parallel linq but in the meantime im just looking for the linq method to get me started.
How to match the string Net-----Amount (or here between Net and Amount there can be any number of space) with net amount ?
Consider ----- as space because I could not keep the space between these two words in the editor.
I'd like to know if there is any class in Java able to check, using its own criteria, how much a String is equal to another one.
Example :
William Shakespeare / William Shakespeare : might be 100%
William Shakespe*a*re / William Shakespe*e*re : might have above 90%
William Shakespeare / Shakespeare, William : might have above 70% (just examples)
I would like to know the easiest way to format a string as accounting style. I know how to format as currency using {0:c} but there are some differences in accounting style, for example, all the dollar signs will line up as well as all the decimal points, and negatives are expressed in parenthesis rather than with a "-" minus sign. You can find a good example of the way i would like it in excel if you format the cells as "accounting" with 2 decimal places.
thanks in advance,
russ
Hi all,
I need help in trimming everything in my string till end after it encounters the first "\0"
So:
"test\1\2\3\0\0\0\0\0\0\0\0\0_asdfgh_qwerty_blah_blah_blah"
becomes
"test\1\2\3"
I am using c#. Help would be greatly appreciated.
Thanks.
Hello
I have written this code to convert string in such format "0(532) 222 22 22" to integer such as 05322222222 .
class Phone():
def __init__(self,input):
self.phone = input
def __str__(self):
return self.phone
#convert to integer.
def to_int(self):
return int((self.phone).replace(" ","").replace("(","").replace(")",""))
test = Phone("0(532) 222 22 22")
print test.to_int()
It feels very clumsy to use 3 replace methods to solve this. I am curious if there is a better solution?
I am trying to combine multiple audit tables, and then filter the results into an excel sheet. The Union All and parameters make the query in excess of 1200 characters. It appears the string is truncated when running this. What recommendations can anyone make. I have no control over the database structure and am only reading foxpro free tables.
I am permitted table creation but can write into the excel sheet connecting to the datasource
Thanks for suggestions
I am trying to use str.encode() but I get
>>> "hello".encode(hex)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: must be string, not builtin_function_or_method
I have tried a bunch of variations and they seem to all work in Python 2.5.2, so what do I need to do to get them to work in Python 3.1?
I have a bit of text
"this is the text want I want to do is replace the text, I have just added another is for good measure"
This is stored as a standard string but I want to turn this into html and add css classes like, in this example wrapping around the word "is";
"this is the text want I want to do
is replace the text, I have just added another is for good measure"
Any ideas how I can do this in as3?
I have a string with the following e.g.
$workingFile = '/var/tmp/A/B/filename.log.timestamps.etc';
And two strings representing a dirs e.g.
$dir = '/var/tmp';
$newDir = '/users/asdf';
I'd like to get the following:
'/users/asdf/A/B/filename.log.timestamps.etc'
However my Perl isnt up to much .. any pointers ?
Thanks
W
Yes, There's More Than One Way To Do It™, but what is the most canonical, most efficient, and most concise methods to read an entire file into a string? (The latter two are perhaps at odds.)
i would like to delete a string or a line inside a ".txt" file ( i.e. filen.txt
). For example, i have these lines in the file:
1JUAN DELACRUZ
2jUan dela Cruz
3Juan Dela Cruz
then delete the 2nd line (2jUan dela Cruz), so the ".txt" file will look like:
1JUAN DELACRUZ
3Juan Dela Cruz
Please help.Thank you
There are Python code available for existing algorithms for normal string searching e.g. Boyer-Moore Algorithm. I am looking to use this on Chinese characters and it doesn't seem like the same implementation would work. What would I go about doing in order to make the algorithm work on Chinese characters? I am referring to this:
http://en.literateprograms.org/Boyer-Moore_string_search_algorithm_(Python)#References
Is it possible to store encrypted connection string so it can be used from server-side vbscript?
Was there an equivalent of web.config in 'the good old days'?
I am developing a c# web application with VS 2008 where I am trying to capture the physical path of the selected file. Using IE, I am finally able to retrieve this now in text variable. But I want to capture this information in string. How do I do this?
Currently I am using:
lb3.Text = Page.Request.PhysicalPath;
And it gives me:
Text = "C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\Default.aspx"
1) Is there any built-in which can tell me if a variable's contents contain only uppercase letters?
2) is there any way to see if a variable contains a string? For example, I'd like to see if the variable %PATH% contains Ruby.
I am getting a string from the user and then doing some checking to make sure it is valid, here is the code I have been using;
char digit= userInput.charAt(0) - '0';
This had been working fine until I did some work on another method, I went to compile and have been receiving a 'possible loss of precision' error since then.
What am I doing wrong?
They're both resizable arrays, and std::basic_string doesn't have any specifically character-related functions like upper(). What's special about string to make it better for character data?