Say, I have a customers with a integer PK. In my web apps I want to have a profile page for them. I do not want a url like /profile/10375/ (For example, I do not want others to know how many customers I have). I also do not want a slug base url like, /profile/acme_corp/.
What is a good way to convert unique integers to unique random sho...
Really simple problem:
I want to split a connection string into its keyword / value pairs, so for example the following connection string:
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=vm-jp-dev2;Data Source=scsql\sql2005;Auto Translate=False
Would become:
Provider=SQLOLEDB.1
Integrated Se...
What would be the best way and more idiomatic to break a string into two at the place of the last dot? Basically separating the extension from the rest of a path in a file path or URL. So far what I'm doing is Split(".") and then String.Join(".") of everything but the last part. Sounds like using a bazooka to kill flies.
...
I just had a simple question, but I cannot seem to find a straightforward answer. I've been wondering this for a while, though.
I have seen several programmers use & and + for string manipulation.
Such as:
dim firstvar as string
dim secondvar as string
dim thirdvar as string
thirdvar = firstvar & secondvar
Or is it:
thirdvar = ...
Hey guys,
I've been going at this problem for a solid couple hours now and having zero luck. No clue how this is even possible; I'll try to summarize.
I'm using TinyMCE to insert new content to a DB, that content is being sent back as an AJAX response after it is inserted into the DB and then shown on the page, replacing some old cont...
Is there a builtin function in php to intelligently join path strings?
Like path_join("abc/de/","/fg/x.php") which should return "abc/de/fg/x.php", but path_join("abc/de","fg/x.php") should have the same result
If not, is there a class availabel. Could also be valuable for splitting paths or removing parts of them. If you have written ...
What is the regular expression for replaceAll() function to replace "N/A" with "0" ?
input : "N/A"
output : "0"
thanx
...
Currently I am working on a piece of software, which is currently written 100% in Objective-C using the iPhone 3.0 SDK.
I have come to a cross roads where I need to do quite a bit or string concatenation, more specifically, NSString concatenation and so far I have been doing it like this:
Objective-C string concatenation:
NSString *re...
Hello,
I am writing a simple program, which is trying to find next palindrome number after given number.
As for now, I am stuck at this point:
string::iterator iter; // iterators for the string
string::iterator riter;
//testcases is a vector<string> with strings representing numbers.
for (unsigned int i = 0; i < testcases.size() ; ...
char *stringmult(int n)
{
char *x = "hello ";
for (int i=0; i<n; ++i)
{
char *y = new char[strlen(x) * 2];
strcpy(y,x);
strcat(y,x);
delete[] x;
x=y;
}
return x;
}
I'm trying to figure out what the flaws of this segment is. For one, it deletes x and then tries to copy it's values over to y....
Hi all,
Im Sorry for my bad English
I need help for my problem. When we open page source of HTML page like google, we will found HTML TAG : (in this google was found my string)
<!doctype html><head><title>bla bla bla
<ol><li class="g w0"><h3 class=r>**bla bla bla..**</div></ol>
<ol><li class="g w0"><h3 class=r>**bla bla bla..**</div><...
Given a string that isn't too long, what is the best way to read it line by line?
I know you can do:
BufferedReader reader = new BufferedReader(new StringReader(<string>));
reader.readLine();
Another way would be to take the substring on the eol:
final String eol = System.getProperty("line.separator");
output = output.substring(outp...
Are there any functions are available for converting all newlines in a string to spaces?
For example:
$a = "dflsdgjsdg
dsfsd
gf
sgd
g
sdg
sdf
gsd";
The result is am looking for is:
$a = "dflsdgjsdg dsfsd gf sgd g sdg sdf gsd"
...
Is there any java utility to convert string to hex value (integer) ?
...
Here's an interesting problem. Is it possible to split a string on the last matching regex only?
Consider the following list of column headings from my data file (which read along the same line, being tab-separated):
Frequency Min
Frequency Avg
Frequency Max
Voltage L1 Min
Voltage L1 Avg
Voltage L1 Max
Active Power L1 Min
Active Power ...
I've got some aspx pages being created by the user from a template. Included is some string replacement (anyting with ${fieldname}), so a portion of the template looks like this:
<%
string title = @"${title}";
%>
<title><%=HttpUtility.HtmlEncode(title) %></title>
When an aspx file is created from this template, the ${title} gets r...
I'm sorry for flaming std::string and std::wstring. They are quite limited and far from being thread safe. Performance wise, they are not that good too. I miss simple features:
Splitting a string into array/vector/list
Simple & intuitive case-insensitive find & replace
Support for i18n without worrying about string or wstring
Conversi...
Hi,
I have a string
string str ="Enter {0} patient name";
So I am using using string.format to format that.
String.Format(str, "Hello");
Now if i want patient also to be retireved from some config then i need to change str something like
"Enter {0} {1} name". So it will replace the {1} with second value. the problem for me is that...
I have the following string in a variable.
Stack Overflow is as frictionless and painless to use as we could make it.
I want to fetch first 28 characters from the above line, so normally if I use substr then it will give me Stack Overflow is as frictio this output but I want output as:
Stack Overflow is as...
Is there any pre-mad...
If I have this:
<img ID="imgField" runat="server" ImageUrl='<%# DataBinder.Eval(Container.DataItem,"Name") %>' />
How can I add "images/" or any other string add on to the url?
I tried
ImageUrl=' "images/" + <%# DataBinder.Eval(Container.DataItem,"Name") %>'
And
ImageUrl= "images/" + '<%# DataBinder.Eval(Container.DataItem,"Name"...