Is there an efficient method in VB to check if a string can be converted to a double?
I'm currently doing this by trying to convert the string to a double and then seeing if it throws an exception. But this seems to be slowing down my application.
Try
' if number then format it.
current = CDbl(x)
current = Math.Round(curren...
Hi guys,
I need to get the company name and it's ticker symbol in different arrays. Here is my data which is stored in a txt file:
3M Company MMM
99 Cents Only Stores NDN
AO Smith Corporation AOS
Aaron's, Inc. AAN
and so on
How would I do this using regex or some other techniques?
Thanks
...
Hello,
I want to output a string that welcomes a used to the application. I have the user's first, middle and last name. I would like to write the user's full name, i.e. "Hello {0} {1} {2}" with first, middle and last being the parameters. However, If the middle name is empty, I don't want two spaces between the first and the last name,...
I have an app that converts binary file into ASCII file. With profiler I found that I spend 25% of time doing Encoding.GetBytes() which is called from BinaryWriter.Write(wchar[]). It is completely correct since I have many constructs similar to this one:
m_writer.Write("some fancy long text".ToCharArray());
Do you have any smart idea...
I have various length strings which are full of Base64 chars. Actualy they are audio recognition datas differs by song-to-song.
For easily comparing parts of those strings i divide them into 16-char sub-strings. (which is about 1 second of a song) But in some cases, i just can't compare these ones head to head.. i should be measuring t...
Hi,
I've got a problem with strings that I get from one of my clients over xmlrpc. He sends me utf8 strings that are encoded twice :( so when I get them in python I have an unicode object that has to be decoded one more time, but obviously python doesn't allow that. I've noticed my client however I need to do quick workaround for now be...
I encountered an interesting situation today in a program where I inadvertantly assigned an unsigned integer to a std::string. The VisualStudio C++ compiler did not give any warnings or errors about it, but I happened to notice the bug when I ran the project and it gave me junk characters for my string.
This is kind of what the code lo...
I have a result set that I want to trim a 2 digit suffix from. The strings will always be of varying lengths, but the suffixes will always be two digits separated by '-'.
Example:
APPTR-W302-01
NRSB-8920-09
Right now I am using the following. This is a hack because the '20' parameter is arbitrary.
REVERSE(SUBSTRING(REVERSE(COURSENAME...
Assuming I do not want to use external libraries or more than a dozen or so extra lines of code (i.e. clear code, not code golf code), can I do better than string.Contains to handle a collection of input strings and a collection of keywords to check for?
Obviously one can use objString.Contains(objString2) to do a simple substring check...
Can anyone verify this for me? JavaScript does not have a version of strcmp(), so you have to write out something like:
( str1 < str2 ) ?
-1 :
( str1 > str2 ? 1 : 0 );
As this question is really just me complaining, I wouldn't normally waste your time with it, but I wasted 30 minutes looking for such a func...
I'm trying a problem from sphere's online judge where I need to find a palindrome for a integer of up to a million digits, I thought about using java's functions for reversing strings, but would they allow for a string to be this long?
...
So, I have learnt that strings have a center method.
>>> 'a'.center(3)
' a '
Then I have noticed that I can do the same thing using the 'str' object which is a type, since
>>> type(str)
<type 'type'>
Using this 'type' object I could access the string methods like they were static functions.
>>> str.center('a',5)
' a '
Alas! Th...
const std::string::size_type cols = greeting.size() + pad * 2 + 2;
Why string::size_type? int is supposed to work! it holds numbers!!!
...
Hi,
I have an input string and I want to verify that it contains:
Only letters or
Only letters and numbers or
Only letters, numbers or underscore
To clarify, I have 3 different cases in the code, each calling for different validation. What's the simplest way to achieve this in C#?
Thanks
...
I have the following Java code to fetch the entire contents of an HTML page at a given URL. Can this be done in a more efficient way? Any improvements are welcome.
public static String getHTML(final String url) throws IOException {
if (url == null || url.length() == 0) {
throw new IllegalArgumentException("url cannot be null or empty...
I want to store lines of strings dynamically using C language.
for e.g
sadasdasda5245sdf
fadfa6456
fasdf90-70=790
the number of such lines and the length of each line can be anything.Is there any way to store the whole thing dynamically.
...
While running my program I get this Error:
terminate called after throwing an instance of 'std::length_error'
what(): basic_string::_S_create
Abort trap
I know that you can't do much without the code but I think that error is to deep in the code to copy all of it. Maybe I can figure it out if I understand what this error means.
I...
SSViewer::set_theme('bullsorbit');
this my string. I want search in string "SSViewer::set_theme('bullsorbit'); " and replace 'bullsorbit' with another string. 'bullsorbit' string is dynamically changing.
...
I'm receiving a string from an external process. I want to use that String to make a filename, and then write to that file. Here's my code snippet to do this:
String s = ... // comes from external source
File currentFile = new File(System.getProperty("user.home"), s);
PrintWriter currentWriter = new PrintWriter(currentFile);...
I wanna create a list of 50 elements which consist of four chars each. Every four char string should go into a loop one by one and get checked for one of three letters (o, a, e) anywhere in the current string. dependent on whether or not these letters are identified different commands are executed
I tried all day im frustrated please he...