string

Java String and Mathematical Expression Evaluators

Hi, We use the Jeks parser at present to evaluate expressions. I cannot see a way to evaluate string expressions with it - for example: IF( "Test 1" = "Test 2") Is there anything out there that can evaluate string and mathematical expressions in Java? Preferably free or open source. Thanks for any help, Andez ...

Using AJAX to loop through Dynamic XML Nodes and inject into a set of h2 elements using jQuery

So, I have a list of nodes in a dynamic XML that is cached on a server. Using Ajax, I loop through the particular nodes to return a string each time: XML: <?xml version="1.0"?> <Products> <Product> <ItemName>String</ItemName> </Product> <Product> <ItemName>String</ItemName> </Product> <Product> ...

Integer to string in C without preallocated char array

Please, look at the following code that just convert an unsigned int to a string (there may be some unhandled cases but it's not my question), allocating a char array in the heap and returning it, leaving the user the responsibility to free it after the use. Can you explain me why such function (and others similar) do not exist in C sta...

Explain this substring please!!

Can someone explain, what is this doing?? I am new and learning txtCardNo.Text.Trim().Substring((txtCardNo.Text.Trim().Length - 4), 4) Thank you!!! ...

Trim only the first and last occurrence of a character in a string (PHP)

This is something I could hack together, but I wondered if anybody had a clean solution to my problem. Something that I throw together wont necessarily be very concise or speedy! I have a string like this ///hello/world///. I need to strip only the first and last slash, none of the others, so that I get a string like this //hello/world/...

how do i solve a data conflict between string and inFile.open

#include<iostream> #include<fstream> #include<cstdlib> #include<string> using namespace std; **int main() { double write(); double read(); string choice; while(1) { cout<<"Enter read to read a file and write to write a file.\n"; cin>>choice; if (choice == "read") cout<< read(); if (c...

Is it always a bad idea to use + to concatenate strings

I have code as follows : String s = ""; for (My my : myList) { s += my.getX(); } Findbugs always reports error when I do this. ...

Delphi - How can i replace \xA0( or non ascii) chars in a string to ' '?

I have an excel file with numerous non-ascii characters which i would like to replace with the space character. This text is to be entered into a MySQL database, and it will not import with these characters in the strings. I get a "HY000 Incorrect string value" when trying to post the row. ...

Convert a html string to server control in ASP.Net

Hi all, i have a problem so hope you guys can help! I have a string in code behind like this string html = "<asp:CheckBox ID=\"CheckBox1\" runat=\"server\" />"; So how to insert it into aspx page and when the page is rendering, it convert my string as i write it own in the webpage Hope you guys can help Thanks in advance! Let me sa...

How can I run a query on IDs in a string?

I have a table A with this column: IDS(VARCHAR) 1|56|23 I need to run this query: select TEST from TEXTS where ID in ( select IDS from A where A.ID = xxx ) TEXTS.ID is an INTEGER. How can I split the string A.IDS into several ints for the join? Must work on MySQL and Oracle. SQL99 preferred. ...

HaXe -- compare two strings ignoring case?

I'm working on a string-to-bool parsing function for HaXe (somehow the devs got by until now without one >.<) and i figured the best way to check the string would be ignoring case. I'm not sure how to do that though, can someone help me? ...

compress a string in python 3 ?

I don't understand in 2.X it worked : import zlib zlib.compress('Hello, world') now i have a : zlib.compress("Hello world!") TypeError: must be bytes or buffer, not str How can i compress my string ? Regards Bussiere ...

Parsing element of a string array into a int

As the question says am trying to parse one of the elements of an string array into a int variable. although the code is right in terms of syntax, when I try to run it, I get the following error message. Error 1 Building content threw FormatException: Input string was not in a correct format. at System.Number.StringToNumber(St...

Is there a way in c# to use strings in a switch statement that are in an array or something similiar?

Im trying to find a solution for this problem. This is my example code: class Program { private string Command; private static string[] Commands = { "ComandOne", "CommandTwo", "CommandThree", "CommandFour" }; static void Main(string[] args) { Command = args[0]; switch(Command) { case Commands[0]: //do someth...

Java: Pattern, Scanner example does not work

I am curious why this pattern doesn't work. String same = "==== Instructions ===="; Pattern title4 = Pattern.compile(same); Scanner scan = new Scanner(same); System.out.println(scan.hasNext(same)); returns: false ...

python string is default global

I have a question about global variable in Python. The code is following. If I do not use global M in function test, It would issue error. But Why it does not show error for string s. I do not declare it as global. global M M = [] s = "abc" def test(): ### global M print M M.append(s) print M UnboundLocalError: local v...

Java: how to collect incoming data fragments into properly terminated strings for subsequent parsing?

I just joined StackOverflow after having found many great answers here in the past. Here's my first question: EDIT: I feel bad... my first question to StackOverflow turned out to be a "wild goose chase". The problem is in the data, not the code reading the data. I was looking for a solution in the wrong place! I will explain in a commen...

Using C++ libraries

Hi whole of our project development is in C. However there are alot of string operations here and there and how much care we make .. we endup having coding errors in string operations and this results most of the time in for buffer overflows ..stack corruptions etc. due to programmers fault. How nice is this idea to just use C++ strin...

String tokenizer, sanitize input?

I'm working on a program that takes in book records in the form <book #>,<name>,<publisher> for example 123,Example Book,Publisher After which, the user is returned to a menu, using numbers to select what option they would like. i get an java.util.InputMismatchException on this menu, whenever the string is taken in with a space. s...

How do I perform an encoding-independent string-comparison in Java?

I'm having a strange problem comparing strings. I send a string to my server (as bytes using getBytes()) from the client. I've ensured that encoding is the same on the client and server by starting both of them with -Dfile.encoding=UTF-8. I noticed the problem when I was trying to perform a valueOf on the string I receive from the clien...