class String contains very useful method - String.Join(string, string[]).
It creates a string from an array, separating each element of array with a symbol given. But general - it doesn't add a separator after the last element! I uses it for ASP.NET coding for separating with "<br />" or Environment.NewLine.
So I want to add an empty row…
class String contains very useful method - String.Join(string, string[]).
It creates a string from an array, separating each element of array with a symbol given. But general - it doesn't add a separator after the last element! I uses it for ASP.NET coding for separating with "<br />" or Environment.NewLine.
So I want to add an empty row…
Using Postgresql 8.4, how can I right-pad a string with blanks without truncating it when it's too long?
The problem is that rpad truncates the string when it is actually longer than number of characters to pad. Example:
SELECT rpad('foo', 5); ==> 'foo ' -- fine
SELECT rpad('foo', 2); ==> 'fo' -- not good, I want 'foo' instead.
…
My application typically recieves a string in the following format:
" Item $5.69 "
Some contants I always expect:
- the LENGHT always 20 characters
- the start index of the text always [5]
- and most importantly the index of the DECIMAL for the price always [14]
In order to identify this string correctly I validate all the…
For string constants its usual to use a class with final String values. But whats the best practice for storing stringarray. I want to store different categories in a constant array and everytime a category has been selected, I want to know which category it belongs to and process based on that.
Addition : To make it more clear, I have…
Hello,
i've got a SQL query which returns multiple rows, and i have :
$data = array(
"nom" => $row['nom'] ,
"prix" => $row['rapport'],
"average" => "$moyenne_ge"
);
which is perfect, but only if my query returns one row.
i tried that :
$data = array();
$data[$row['nom']]["nom"] = $row['nom'] ;
...…
Briefly:
I'm after the equivalent of .NET's String.Trim in C using the win32 and standard C api (compiling with MSVC2008 so I have access to all the C++ stuff if needed, but I am just trying to trim a char*).
Given that there is strchr, strtok, and all manner of other string functions, surely there should be a trim function,…
Is there a way to get all format parameters of a string?
I have this string: "{0} test {0} test2 {1} test3 {2:####}"
The result should be a list:
{0}
{0}
{1}
{2:####}
Is there any built in functionality in .net that supports this?
I have a java string which has an dollar value and cents value after decimal points and starting with a + or - sign. I want to convert into cents and store it in a integer (it can have + or -). Also i need to check if the cents part (after decimal point) not more than 2 digits and throw an error message if exists
example :…
JAVA
Hello,
I have a TextArea with enter seperated values:
For Example:
Value1
Value2
Value3
Value4
Value5
Is there a fast way to put them in a Stringarray
String[] newStringArray = ???
I want to convert a string like this:
'10/15/2008 10:06:32 PM'
into the equivalent DATETIME value in Sql Server.
In Oracle, I would say this:
TO_DATE('10/15/2008 10:06:32 PM','MM/DD/YYYY HH:MI:SS AM')
This question implies that I must parse the string into one of the standard formats, and then convert using one of…
I have a TextArea with enter seperated values:
For Example:
Value1
Value2
Value3
Value4
Value5
Is there a fast way to put them in a Stringarray
String[] newStringArray = ???
Is there a way to tokenize a string in C++ with multiple separators? In C# I would have done:
string[] tokens = "adsl, dkks; dk".Split(new [] { ",", " ", ";" }, StringSplitOptions.RemoveEmpty);
Is there an equivalent in Javascript to the C function strncmp? Strncmp takes two string arguments and an integer length argument. It would compare the two string up to length and determine if they were equal as far as length went.
Does javascript have an equivalent built in function?
I'm trying to match a word in a string to see if it occurs at the end of that string. The usual strpos($theString, $theWord); wouldn't do that.
What would be the most efficient way to do it?
I installed open manage on a couple of my PE 2950s for snmp monitoring of the RAID. All the checks seem to come back okay except for controllerState:
[root@aMachine ~]# snmpwalk -v 2c -c bestNotToPostPasswords myMachine -m +StorageManagement-MIB controllerstate
StorageManagement-MIB::controllerState.1 = INTEGER:…
I've got a JSP page with a piece of Javascript validation code which limits to a certain amount of characters on submit. I'm using a <textarea> so I can't simply use a length attribute like in a <input type="text">.
I use document.getElementById("text").value.length to get the string length. I'm running…
Let's say I have a set of keywords in an array {"olympics", "sports tennis best", "tennis", "tennis rules"}
I then have a large list (up to 50 at a time) of strings (or actually tweets), so they are a max of 140 characters.
I want to look at each string and see what keywords are present there. In the case where a…
Judging from the title, I kinda did my program in a fairly complicated way. BUT! I might as well ask anyway xD
This is a simple program I did in response to question 3-3 of Accelerated C++, which is an awesome book in my opinion.
I created a vector:
vector<string> countEm;
That accepts all valid strings.…
Let's say I have two objects: User and Race. User has two attributes: first_name, last_name. And Race has three attributes: course, start_time, end_time.
Now let's say I create an array of hashes like this:
user_races = races.map{ |race| {:user = race.user, :race = race} }
How do I then convert user_races into…
Hello,
I have an array of string, like:
char **strings = {"str1", "str2"};
And i would like to know if there is a function in the glib to find the position of a string in this array.
I guess i could just do g_strcmp0 in a for() loop, but there may be a better way to do it.
Thanks
I'm trying to interpolate environment variables into a string in Ruby and not having much luck. One of my requirements is to do something (log an error, prompt for input, whatever) if a placeholder is found in the initial string that has no matching environment variable. It looks like the block form of String#scan…
I'm working on a bank interface project, where I have to search an array of string when the user types in his username. The array has 10 strings, but only the first string is recognized as a valid username...I'm positive that the syntax of the search technique(Linear Search) is correct, but I cannot seem to find…