string

perl: use string as piece of code

Hello, I would like to use a string (e.g. read from a file) as a piece of code in my perl program. For example, I read a string (e.g. $str="1..100,171,398..1000") then I would like to print all the numbers in the range represented by the string. Thanks, Dave ...

Using properties of objects in a listbox

I've got this nifty little piece of code here that self-propogates ad infinitum every time the relevant method is called: if (this.ListBox_MyListBox.Items[e.Index] is MyObject) { MyObject epicObject= new MyObject(); epicObject= (MyObject)this.ListBox_MyListBox.Items[e.I...

Changes to AS3 array of string variables doesn't update the variables themselves...

I have to assume I am missing something simple, or I am not understanding something, but I can't seem to figure this. I have a list of strings that I add to an array, then attempt to set those values in a for-loop using data that I read in. The array gets updated, but the values the array contains do not. I also have an array of buttons...

date from string help. I can convert to the string I want, but I can't convert back.

I have a string I need to convert back to a date. I can call .ToString("yyyyMMdd") and get the string i want. My question is how can I convert that back into a date? I'm trying something like the following with no luck. DateTime d; var formatInfo = new DateTimeFormatInfo {ShortDatePattern = "yyyyMMdd"}; if (DateTime.TryParse(details.Det...

Parse Tokens from a String - C Programming - StrTok Issue

My application produces strings like the one below. I need to parse values between the separator into individual values. 2342|2sd45|dswer|2342||5523|||3654|Pswt I am using strtok to do this in a loop. For the fifth token, I am getting 5523. However, I need to account for the empty value between the two separators || as well. 5523 ...

printf not printing to xcode debugger when format string is involved (in a plugin environment)

Hi, I have a pretty obscure problem here. I'm writing a photoshop plugin (for mac) using Xcode. I use printf statements for simple debugging. A printf without a format string works fine, however, if I use a format string to try and print out a value it does not show up in xcode's debugger console. #include <stdio.h> DLLExport ...

Stripping some characters out of a string

I try to remove some non-safe characters from a string but i believe i have a problem on my RegExp object. What i try to do below is if there are chars whose encoded length is greater than 3 chars they should be replaced with a space. So if encoded value is %3D which is = sign, it is ok to have in my string. But if it is an ’ apostroph...

What is the Java equivalent of Perl's qq operator?

I have a very long string which includes many new lines ( it's a really long SQL statement ). The SQL is easier to read when I break it up with newlines. But from time to time, I need to copy the sql statement from code to paste into sql developer. In Perl, I always loved the qq operator, which you can use in place of double quotes: ...

Need help with Javascript Regular Expressions - Splitting text

I have a string that represents a list of tags separated by space. It may look like this: Australia 2010 David November Family If a tag contains at least one space, it must be quoted. So the string can be: "Best Friends" "My Pictures" Wow "Very Nice Photo" University Quotes are also allowed for single words. For example: "Good One...

strings in hebrew in python for s60

I'm using python for S60. I want to use string in hebrew, to represent them on the GUI and to send them in SMS message. It seems that the PythonScriptShell don't accept such expressions, for example: u"אבגדה" what can I do? thanks development of situation: I added the line: # -*- coding: utf-8 -*- as the first line in the source ...

Question about reversing a string

i am trying to do a simple string manipulation. input is "murder", i want to get "murderredrum". i tried this String str = "murder"; StringBuffer buf = new StringBuffer(str); // buf is now "murder", so i append the reverse which is "redrum" buf.append(buf.reverse()); System.out.println(buf); but now i get "redrumredrum" instead of "m...

How to optimize this ugly code?

I make the other day a question here, but finally I decided to do it myself for questions of time, now I have a little more time to fix it :D I liked jSoup, but I'm kind of from old school, and preffer doing it my self (thanks to @Bakkal anyway). I manage to made this code, it works fine for now, but if a webpage is not well contructed ...

echo <img> tag...

Hello there, I getting crazy trying to echo an <img> tag I want to add this simple string "/uploads/" before $photo->name...Here is my echo: echo '<img src="'.$photo->name.'"/>'; thanks for any help... ...

using slash in python (not to escape)

import os path= os.getcwd() final= path +'\xulrunner.exe ' + path + '\application.ini' print final I want the out put: c:\python25\xulrunner.exe c:\python25\application.ini I don't want slash to work as string, i mean don't want it to escape or do anything special. But i get an error Invalid \x escape How can i use a '\' ...

C++ char * to string

Possible Duplicate: how to copy char * into a string and vice-versa I have to pass a value into a method that required a char * MyMethod(char * parameter) { // code } However, the parameter I need to feed it is currently a std::string. How do I convert the std::string to a char *? std::string myStringParameter = //what...

Python index more than once.

I know that .index() will return where a substring is located in python. However, what I want is to find where a substring is located for the nth time, which would work like this: >> s = 'abcdefacbdea' >> s.index('a') 0 >> s.nindex('a', 1) 6 >>s.nindex('a', 2) 11 Is there a way to do this in python? ...

C++ convert string to hexadecimal and vice versa

What is the best way to convert a string to hex and vice versa in C++? Example: A string like "Hello World" to hex format: 48656C6C6F20576F726C64 And from hex 48656C6C6F20576F726C64 to string: "Hello World" ...

php read from file float

Hello I have a text file with three lines. every line has a float number. How can I take each value and put in a float variable even if array? For example text file is like the following +3.01\n -0.0012\n -0.1\n I want an array [if it possible] which save the values as float not as string. Thanks ...

Storing property value names as String constants - performance and memory usage?

I use around 1000 properties associated with a specific java.util.Properties which is backed by a file. The main reason for the file is to change them without recompiling the program and to allow users to adjust their according to their taste. Some of the properties are used only in one place in the code, but there are some properties th...

Why is String class final?

Possible Duplicate: Why is String final in Java? There are various moments in my programming life that I wished the the String class had not been final/sealed/NotInheritable. What are the language architects trying to prevent me from doing that would throw a monkey wrench into the works. Rather, what are the monkey wrenches ...