string

[Python]String and integer concatenation

Hi, I want to create string in a for. # Create string0, string1 ..... string10 for i in range [1,10]: string="string"+i But I have returned an error because i is not a string but integer. How I can do it? Thanks. ...

Registry Problem

I made a launcher for my game server. (World of Warcraft) I want to get the installpath of the game, browsed by the user. I'm using this code to browse, and get the installpath, then set some other strings from the installpath string, then just strore in my registry key. using System; using System.Drawing; using System.Reflection; using...

Sorting mysql array value after string chars swapped from fetched DB data.

I want to sort one column fetched from mysql DB, and stored in an array. After fetching I am doing below steps. DB Fetching fields array in row format. ->Field1, Field2, Field3, Field4, Field5 From that fields array One columns data [Field3], swapping string keywords. eg. AB013, DB131, RS001 should become: 013AB, 131DB, 001RS N...

How can I clip strings in Java2D and add ... in the end?

I'm trying to print Invoices in a Java Swing applications. I do that by extending Printable and implement the method public int print(Graphics g, PageFormat pf, int page). I would like to draw strings in columns, and when the string is to long I want to clip it and let it end with "...". How can I measure the string and clip it at the r...

Skip first regex match

Hi, Is there anyway to skip the first match when using regex and php. Or is there some way of achieveing this using str_replace. Thanks UPDATE I am trying to remove all the instances of a string from another string but I want to retain the first occurance e.g $toRemove = 'test'; $string = 'This is a test string to test to removing t...

split a string based on pattern in java - capital letters and numbers

Hi all I have the following string "3/4Ton". I want to split it as --> word[1] = 3/4 and word[2] = Ton. Right now my piece of code looks like this:- Pattern p = Pattern.compile("[A-Z]{1}[a-z]+"); Matcher m = p.matcher(line); while(m.find()){ System.out.println("The word --> "+m.group()); } It carries out the needed task of ...

JSTL expression evaluation from a string

Is it possible to evaluate a String as EL expression in JSP and get value from it? I need an expression like ${model.${fieldPath}} where fieldPath will contain the required object path from a nested object model. I can get the actual field path by using but I am not sure how to evaluate a string and get the value from it Any help r...

Searching through large data set

how would i search through a list with ~5 mil 128bit (or 256, depending on how you look at it) strings quickly and find the duplicates (in python)? i can turn the strings into numbers, but i don't think that's going to help much. since i haven't learned much information theory, is there anything about this in information theory? and si...

get length of `wchar_t*` in c++

Please, how can I find out the length of a variable of type wchar_t* in c++? code example below: wchar_t* dimObjPrefix = L"retro_"; I would like to find out how many characters dimObjPrefix contains ...

javascript/php - shorten string to fit into a certain # of lines

Hi I have a string that must fit into a box, and must be at most 3 lines long. To shorten it, I plan to truncate it and end it with '...'. I could shorten it to a certain # of characters but if i make it look good with "wwwwwwwww [...] wwww" it won't look right with "iiiiiiiiiii [...] iiii". Is there some way I can shorten it by how mu...

XSLT string with HTML entities - How can I get it to render as HTML?

I'm completely new to using XSL, so if there's any information that I'm neglecting to include, just let me know. I have a string in my XSLT file that I can display like this: <xsl:value-of select="@Description/> and it shows up, rendered in a browser like: <div>I can't do anything about the html entities existing in the text.</div> ...

PHP mySQL - replace some string inside string

i want to replace ALL comma , into ,<space> in all address table in my mysql table. For example, +----------------+----------------+ | Name | Address | +----------------+----------------+ | Someone name | A1,Street Name | +----------------+----------------+ Into +----------------+----------------+ | Name ...

reading a string with spaces with sscanf

For a project I'm trying to read an int and a string from a string. The only problem is sscanf appears to break reading an %s when it sees a space. Is there anyway to get around this limitation? Here's an example of what I'm trying to do: #include<stdio.h> #include<stdlib.h> int main(int argc, char** argv) { int age; char* buff...

string function workout in php

I have the string like this, $inp1 = "3 doses at 0[0,0], 1-2 and 6 Month[6,1] [3,2])"; in this internally, going to take the values of square bracket. How can i take this values in the square bracket? any function is there to return the string like this [0,0] [6,1] [3,2] Thanks in advance for help. ...

Resolve bash variable containted in another variable

I have code like that: TEXT_TO_FILTER='I would like to replace this $var to proper value in multiline text' var=variable All I want to get is: TEXT_AFTER_FILTERED="I'd like to replace this variable to proper value" So I did: TEXT_AFTER_FILTERED=`eval echo $TEXT_TO_FILTER` TEXT_AFTER_FILTERED=`eval echo $(eval echo ...

How to evalute a string twice in Powershell

anyone know how to evalute a string twice in powershell? from example $l1 = yes $l2 = no for (i=0;i -lt 2; i++) { echo $1$i } ...

Django: How do I prepend

Hello, I'm exploring Django and got this particular problem. How do I prepend <span class="label">Note:</span> inside {{article.content_html|safe}}? The content of {{article.content_html|safe}} are paragraph blocks, and I just wanna add <span class="label">Note:</span> in the very first paragraph. Thanks! ...

sql vs hashtable.containskey vs string.contains

I have a list of values extracted from a sql query in order to find out if x provided values are present in it. SQL: -Select null from table where code='x' -resul.count>0 String: -Loop for concatenating the codes in one string -codesstring.Contains("x") Hashtable: -Loop for adding the codes to the hashtable -codeshashtabl...

stdout and stderr character encoding

i working on a c++ string library that have main 4 classes that deals with ASCII, UTF8, UTF16, UTF32 strings, every class has Print function that format an input string and print the result to stdout or stderr. my problem is i don't know what is the default character encoding for those streams. for now my classes work in windows, later ...

[Linq-To-Sql]How to return two values of different datatypes?

Here is my repository method which returns UserId , public IQueryable<int> getLoginStatus(string emailId, string password) { return (from r in taxidb.Registrations where (r.EmailId == emailId && r.Password == password) select r.UserId); } How to return UserName which is a string along with UserId... Any sugge...