var str = 'single words "fixed string of words"';
var astr = str.split(" "); // need fix
i want the array to be like: single, words, fixed string of words.
I've built an API using actionwebservice and when a client calls a method to pass in an empty string (""), it's to_s value is # instead of "". But when the client passes in "hello", it's to_s value is "hello".
class UsersApiController < ApiController
web_service_api UserApi
def create_or_update(arg1)
Rails.logger.info arg1.to_s # Displays "#<SOAP::Mapping::Object:0x3a89c08>" if arg1 is an empty string
end
end
Hi,
I want to check whether a string starts with any character in a list. My current implementation in C# is as follows:
char[] columnChars = new char[] { 'A', 'B', 'C', 'D', 'E' };
private bool startWithColumn(string toCheck)
{
for(int i=0; i<columnChars.Length; i++)
if (toCheck.StartsWith(columnChars[i]+""))
{
return true;
}
return false;
}
I would like to know if any solution is better?
I need to split this line string in each line, I need to get the third word(film name) but as you see the delimeter is one big blank character in some cases its small like before the numbers at the end or its big as in front of numbers at front.
I tried using string split with(" ") regex, and also \t but get the out of the bounds error.
400115305 Lionel_Atwill The_Song_of_Songs_(1933_film) 7587
400115309 Brian_Aherne A_Night_to_Remember_(1943_film) 7952
Did anyone have the same problem?
Hello all ,
I have a string like "SAB_bARGS_D" . What I want is that the string gets divided into list of characters but whenever there is a _ sign the next character gets appended to the previous one.
So the answer to above should be ['S','A','B_b','A','R','G','S_D']
It can be done by using a for loop traversing through the list but is there an inbuilt function that I can use.....
Thanks a lot
c code
extern "C" __declspec(dllexport) int export(LPCTSTR inputFile, string &msg)
{
msg = "haha"
}
c# code
[DllImport("libXmlEncDll.dll")]
public static extern int XmlDecrypt(StringBuilder inputFile, ref Stringbuilder newMsg)
}
I got an error when I try to retrieve the content of newMsg saying that I'm trying to write to a protected memory area.
What is the best way to retrieve the string from c to c#. Thanks.
I have a string which is converted from date to string and the data looks like this "6/2/2010 4:30:00 PM6/2/2010 4:45:00 PM" and I need output like this 04:30PM could u pls help.. thanx :-)
Hi all,
I have a Windows Forms application (C#) containing a ListBox into which I have added some items (I'm not using a DataSource). I want to filter the items in the ListBox to show only items containing a string I'm searching for.
I have done this by keeping a list of the original items and selecting matching items from that list each time the search string changes and updating the ListBox.Items
Is there a more elegant/efficient way to do this?
Hi,
I want to execute a query like
select ID from "xyz_DB"."test" where user in ('a','b')
so the corresponding code is like
String s="(";
for(String user:selUsers){
s+= " ' " + user + " ', ";
}
s+=")";
Select ID from test where userId in s;
The following code is forming the value of s as ('a','b',)
i want to remove the comma after the end of array how to do this ?
how can i copy part of the specific string to the another place
example
(aaa),(ddd),(fff),(fff),#p
copy (ddd) to the side of the p
(aaa),(fff),(fff),#p,(ddd) //before copyin add comma
copy (fff) to side of the (ddd)
(aaa),(fff),#p,(ddd),(fff) //string lenght always same
hi,
i have an string like this
string strdate =@"5/2/2006";
which is in a form of month/day/year
i need to display it in a form of like this 02-05-2006
how do i format the data like this
if the value is like this 12/28/2005
it should be displayed like this 28-12-2010
i know we should be splitting the data based on that we should do it.
i am not getting the syntax how to do it .
any help would be great
I have string like this:
"Some standard text CONST_INSIDE_QUOTES" blah blah CONST "There might be another quotes"
The thing is, that i want to replace all constants in string with some text, but it mustn't be applied on constants inside text in quotes. I have this regex:
sed "s/([A-Z][A-Z0-9_]*)([^a-z])/<span class=\"const\"\1<\/span\2/g"
which of course works for all consts. Any ideas how to exclude its apply on quotes constants? Unfortunately sed only...
I am using ofstream() to write data into file, i want to program to perform such a way that it should be keep on writting the string into the file as soon as the value gets assingned to string variable, and it should be writting before calling the close() for the buffer and while the program runs itself.
can anyone help me to do that in c++.........
When I do System.out.println(map) in Java, I get a nice output in stdout. How can I obtain this same string representation of a Map in a variable without meddling with standard output? Something like String mapAsString = Collections.toString(map)?
Hi,
Is there anyway to convert a string value to a Range object ? I'm having a function which takes a Range object as a argument and need to pass a single string parameter to it
Thank You
Given a String array such as this:
string[]={"bmw"," ","1bmw"," "};
I need to count how often the substring bmw occurs in that array. In this example it occurs 2 times.
How do I write that in C#?
How do you reverse a string in Ruby? I know about string#reverse. I'm interested in understanding how to write it in Ruby from scratch preferably an in-place solution.
i know you can find the first and last occurrence in a string using strstr() and strchr but how do i find the second occurrence, and the third occurrence of needle inside haystack? im using this to find the last occurrence of needle and the first occurrence of another needle and their position, then return the string that is in between each. thank you.
I am trying to include huge string in my c++ programs, Its size is 20598617 characters , I am using #define to achieve it. I have a header file which contains this statement
#define "<huge string containing 20598617 characterd>"
When I try to compile the program I get error as fatal error C1060: compiler is out of heap space
I tried following command line options with no success
/Zm200
/Zm1000
/Zm2000
How can I make successful compilation of this program?
Platform: Windows 7
Is there a limited-length string class around? I've searched a
little on the net and didn't find anything. I'm interested in a
class that limits (possibly at compile time) the length to 255,
so marshalling the string's length only requires one byte.
In my header file I'm getting the
error: ‘string’ has not been declared
error but at the top of the file I have #include <string>, so how can I be getting this error?
Hi, I am writing a function like this.
func :: IO()
func = putStr print "func = putStr print"
I know it is incorrect but the idea is I want the putStr applied onto the string then print applied onto the same string "fun = .." so that the output would be:
func = putStr print "func = putStr print"
which is the same as my function definition. Thanks
public struct Items
{
public string Id;
public string Name;
}
public Items[] _items = null;
if (_items.Contains("Table"))
{
// i need to check the structure and need to return correponding id
}
and am having a list of variables in my structure variable...
i need to search a Name in the structure(_items) and i want to return the Corresponding Id.
how to do this,
hi
lets say i have an string str="45.6767676";
now in output i need to show as 45.67
if the string as str= "4";
then show the output as 4
is there any built in function to do this.
thanks
string s = "string";
Console.WriteLine(s[1]); // returns t
char[] chars = s.ToCharArray();
Console.WriteLine(chars[1]); // also returns t
so what is the point in this method?