Hi, everyone,
I want to ask a question about Java. I have use the URLConnection in Java to retrieve the DataInputStream. and I want to convert the DataInputStream into a String variable in Java. What should I do? Can anyone help me. thank you.
The following is my code:
URL data = new URL("http://google.com");
URLConnection dataConnect...
Hi,
I have string like this:"0:385" (first number is seconds, next numbers are milliseconds), I want to use in datagridview with sorting like numbers (not like strings) so I am trying to make DateTime from string but I am not sure how exactly do this. I know I should use method Parse (or ParseExact) but when I tried it it says "String wa...
i have following code
#include <iostream>
#include <string>
using namespace std;
string replace(string s){
for (int i=0;i<s.length();i++){
if (s[i]> 'b' && s[i]<'f'){
s.erase(s[i]);
}
}
return s;
}
int main(){
string s;
cin>>s;
cout<<replace(s)<<endl;
return 0;
}
if i en...
I don't know the slightest bit of Perl and have to fix a bug in a Perl script.
Given a variable $myvar which contains a string, if the first character is a dot, replace it with "foo/bar".
How can I do this?
(Bonus points if you can guess the bug)
...
Possible Duplicate:
How can I use a variable as a variable name in Perl?
Is this doable? I need to change a string into variable.
Example:
If I have a variable like this:
$this_is_test = "what ever";
$default = "this";
$default = $default . "_is_test";
I want $default to take the value of $this_is_test.
...
I'm testing in internet explorer 8 on windows XP and hitting into a tedious bug. I am trying to test strings with a regular expression that works fine in firefox and fine tested indepedantly in the ie8 console.
But when it through my closure function the string acts strangly
[Edit] more detailed code:- Not as nice or clean as the earli...
Possible Duplicate:
Why does abcd.StartsWith() return true?
Whilst debugging through some code I found a particular piece of my validation was using the .startsWith() method on the String class to check if a String started with a blank character
Considering the following :
public static void main(String args[])
{
Strin...
do I need to take care of memory allocation, scope and deletion about c++ "string" object?
for example:
#include <string>
const char* func3() {
string s = "this is a literal string";
return s.c_str();
}
string func2() {
string s = "this is a literal string";
return s;
}
const char* func1() {
const char* s = "this is a...
Hi there.
How do I find multiple occurrences of a string within a string in Python? Consider this:
>>> text = "Allowed Hello Hollow"
>>> text.find("ll")
1
>>>
So the first occurrence of ll is at 1 as expected. How do I find the next occurrence of it?
Same question is valid for a list. Consider:
>>> x = ['ll', 'ok', 'll']
How do ...
if (strpos(htmlentities($storage->getMessage($i)),'chocolate'))
Hi, I'm using gmail oauth access to find specific text strings in email addresses. Is there a way to find text instances quicker and more efficiently than using strpos in the above code? Should I be using a hash technique?
...
I have two identical strings, one in an array and one in a String variable. When I compare these IDENTICAL strings I get false every time. I have debugged and debugged, but I get the same result every time. Here is the code in question
String temp = ""+(num1*num2);
Boolean equal = temp == answers[i];
if(equal) {
correct[i] = true;
...
how do i write a function removeThese(stringToModify,charsToRemove) that will return a string which is the original stringToModify string with the characters in charsToRemove removed from it.
...
I have a Java method I want to call from JRuby. The argument I want to pass is just a normal string (org.jruby.RubyString), but the Java method is overloaded to take either:
java.io.InputStream
byte[]
com.google.protobuf.ByteString
What's an easy way I can convert my string to an instance of one of those classes?
...
I have a long string that has a running list of all the "words entered" in the text box.
I want to be able to check the long string against a one word string to see if the long string contains the word in the short string.
Any ideas?
I've tried this and a few other things, where newString is the long string and currentTextrightnow is ...
Is there something like a C# Substring for Java? I'm creating a mobile application for Blackberry device and due to screen constraints I can only afford to show 13 letters plus three dots for an ellipsis.
Any suggestion on how to accomplish this?
I need bare bones Java and not some fancy trick because I doubt a mobile device has acces...
In my program i want to input a string of integer e.g 2107900000. I want to get its length and then want to remove all the 0's and 1's.
...
What is the escape sequence for ' " ' in C? In other words, how can i ask a while-statement to search for an occurance of ' " '?
...
I want to replace repeated instances of the "*" character within a string with a single instance of "*". For example if the string is "***abc**de*fg******h", I want it to get converted to "*abc*de*fg*h".
I'm pretty new to python (and programming in general) and tried to use regular expressions and string.replace() like:
import re
p...
I was wondering if it is possible to grab a String[] of an unknown size from a class using the java reflection API and store it elsewhere?
Thanks.
...
Can the first char of a string be retrieved by doing the following?
MyString.ToCharArray[0]
...