I have the following code that is meant to convert milliseconds into hours, mins and seconds:
int hours = floor(rawtime / 3600000);
int mins = floor((rawtime % 3600000) / (1000 * 60));
int secs = floor(((rawtime % 3600000) % (1000 * 60)) / 1000);
NSLog(@"%d:%d:%d", hours, mins, secs);
NSString *hoursStr = [NSString stringWithFor...
I am trying to parse a CSV file containing some data, mostly numeral but with some strings - which I do not know their encoding, but I do know they are in Hebrew.
Eventually I need to know the encoding so I can unicode the strings, print them, and perhaps throw them into a database later on.
I tried using Chardet, which claims the stri...
Hello all,
I have a problem concerned with losing of precision
my task is to print numbers as strings
int exponent = ...
int[] Mantissas = { 1, 2, 5 };
double dataStep = java.lang.Math.pow(10.0, exponent) * Mantissas[mantissaIndex];
...
for (int i = 0; i < NSteps; i++)
steps[i] = firstStep + i * dataStep;
draw(ste...
I heard that in PHP there are some alternatives for the functions substr() and strlen() which handles safer bits. Is this true and if it is then what are those functions? I heard that it is based on the function strcmp() but I don't see directly how can I use it.
...
In bytes_test.go I see:
a := Split([]byte(tt.s), []byte(tt.sep), tt.n)
where tt.s and tt.sep are strings. But when I try to do
a := bytes.Split([]byte("test"), []byte("e"), 0)
I get:
cannot convert "test" (type ideal string) to type []uint8 in conversion
cannot convert "e" (type ideal string) to type []uint8 in conversion
...
Hi,
I want to replace all the occurances of a period '.' in a JavaScript string
For example, I have
var mystring = 'okay.this.is.a.string';
I want to get -> okay this is a string
so far I tried
mystring.replace(/./g,' ')
but this ends up with all the string replaced to spaces. Any idea how to resolve this?
...
Hai. I was making this simple string class and was wondering if there was a more natural way of doing it.
class Str{
function __construct($str){
$this->value = $str;
$this->length = strlen($str);
..
}
function __toString(){
return $this->value;
}
..
}
so now i have to use it like th...
I didn't find it on their doc http://www.sqlite.org/lang_corefunc.html
So just want to get confirm or options here.
...
Having read the documentation of Java's String class, it doesn't appear to support popping from front(which does make sense since it's basically a char array). Is there an easy way to do something like
String firstLetter = someString.popFront();
which would remove the first character from the string and return it?
...
Hello there, This is related to my previous question. Basically, given a string of characters, how do I go through it and assign all the numbers within that string into an integer variable leaving out all other characters?
Not at input but when there is a string of characters already read in through gets();
...
I want to convert Date & time value into varchar and then store in database
I am fetching the Current Date & time using NOW() in mysql and now want to convert it in string because i have to merge this value with String value
...
Hi,
I have a string like this "0011100001100111", and i would like to know the length of each sequence (00, 111, 0000, 11, 00, 111), in the right order.
How can I do that in PHP ?
Thanks to who will help me.
...
In the D language how I can read all standard input and assign it to a string (with Tango library) ?
...
i have a string and i need to add a number to it i.e a int. like:
string number1 = ("dfg");
int number2 = 123;
number1 += number2;
this is my code:
name = root_enter; // pull name from another string.
size_t sz;
sz = name.size(); //find the size of the string.
name.resize (sz + 5, account); // add the accoun...
Hi. I need to get the Portuguese text content out of an Excel file and create an xml which is going to be used by an application that doesn't support characters such as "ç", "á", "é", and others. And I can't just remove the characters, but replace them with their equivalent ("c", "a", "e", for example).
I assume there's a better way to...
If I have a string in Groovy like so...
'user.company.name'
... and I want to get the the word "company" and "name" from that string, what is the best way to go about it?
I was thinking of something like this, but I'm not sure if it's the most efficient/groovy way:
def items = 'user.company.name'.tokenize('.')
def company = items[-2...
if you know the start and end positions in string from where to begin and end the search. For example -
string s = StringStringString
|S |t |r |i |n |g |S |t |r |i |n |g |S |t |r |i |n |g
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
How would you find "tr" in the string specifying the the position to begin search is at inde...
So basically, if I have a (finite or infinite) list of (finite or infinite) lists of strings, is it possible to sort the list by length first and then by lexicographic order, excluding duplicates? A sample input/output would be:
Input:
[["a", "b",...], ["a", "aa", "aaa"], ["b", "bb", "bbb",...], ...]
Output:
["a", "b", "aa", "bb", "a...
I have a big number, which I need to split into smaller numbers in Python. I wrote the following code to swap between the two:
def split_number (num, part_size):
string = str(num)
string_size = len(string)
arr = []
pointer = 0
while pointer < string_size:
e = pointer + part_size
arr.append(int(stri...
Hi there, given a string say " a 19 b c d 20", how do I test to see if at that particular position on the string there is a number? (not just the character '1' but the whole number '19' and '20').
char s[80];
strcpy(s,"a 19 b c d 20");
int i=0;
int num=0;
int digit=0;
for (i =0;i<strlen(s);i++){
if ((s[i] <= '9') && (s[i] >= '0')){...