Is regular expression matching every single string?
for example:
String s = "android4you2 and 4us";
how the regex that i have to write to make "s" only for [a-z]
thanks
biggerthanbigger said:
Is regular expression matching every single string?
for example:
String s = "android4you2 and 4us";
how the regex that i have to write to make "s" only for [a-z]
thanks
Click to expand...
Click to collapse
Nobody knows about that?
Related
I'm a newbie when it comes to programming, but I'm having trouble. I've googled/searched for a while and can't solve this.
I'm reading input from a file and inserting everything into a string array. Now, I have to convert the strings to integers, and put that into an array (which I know how to do with parseInt), but the commas in the file are causing a number format exception.
I have to use the stringtokenizer to get rid of the commas but I can't figure out how to do it.
Do I use a for loop and do it line by line? Please advise.
sillymcnasty said:
I'm a newbie when it comes to programming, but I'm having trouble. I've googled/searched for a while and can't solve this.
I'm reading input from a file and inserting everything into a string array. Now, I have to convert the strings to integers, and put that into an array (which I know how to do with parseInt), but the commas in the file are causing a number format exception.
I have to use the stringtokenizer to get rid of the commas but I can't figure out how to do it.
Do I use a for loop and do it line by line? Please advise.
Click to expand...
Click to collapse
What do you mean the "commas in the file"?
Are you doing this?
listArray.toString()
If so, it will use the "," separator. To get it into a String[] list now, do listArray.toString().split(", ")
I think you know how to do the rest. I would do it with a simple 3-line for-loop.
Sent from my Galaxy Nexus running Android 4.2 JB
Here is sample code how to use StringTokenizer:
StringTokenizer tok = new StringTokenizer("1,2,3,4", ",");
while (tok.hasMoreTokens()) {
System.out.println(Integer.parseInt(tok.nextToken()));
}
I have a string, which user just inputted and I want to print out specific letter. App stops working just when I enter any sort o string on my phone. Here is the code.
Code:
String check = keyword.getText().toString();
if (check.length() > 2){
result.setText(check.charAt(j));
}
I found that the problem is check.chartAt(j) line, without it, app doesn't crash.
Why chartAt make my app to crash? are there any alternatives to charAt?
What is "j"?
You should probably check that "j" is less than string length and do something like:
if (j < check.length()){
result.setText(check.charAt(j));
}
Hi all,
I build a software for myself that read from Whatsapp db (that stored on my android device)..
I trying to read from thumb_image column but cannot find the correct way ...
I write this software on c# language... and the code for read its column as follows:
//thumbImage is the value that stored in thumb_image column.
byte[] encodedbytes = System.Text.Encoding.Unicode.GetBytes(thumbImage);
string encoded = System.Convert.ToBase64String(encodedbytes);
byte[] utf8Decoded = System.Text.Encoding.UTF8.GetBytes(encoded);
File.WriteAllBytes("Images\\" + mdeiaName, utf8Decoded);
but it's not working, so i trying to use IronPython as following:
string pythonScript = @"import base64
class DecryptString(object):
def Decrypt(self, str):
return base64.b64encode(str).decode(""utf-8"")";
ScriptEngine engine = Python.CreateEngine();
ScriptSource source = engine.CreateScriptSourceFromString(pythonScript);
ScriptScope scope = engine.CreateScope();
source.Execute(scope);
dynamic DecryptString = scope.GetVariable("DecryptString");
dynamic decryptString = DecryptString();
var result = decryptString.Decrypt(thumbImage);
File.WriteAllText("Images\\" + mdeiaName, result);
but without success...
Can somebody help me?
Hi,
I try to implement a server side verification of an application with LVL library.
I use this php code : http://code.google.com/p/android-market-license-verification/
In the file sample/verify.php, I have two lines to complete :
Code:
$responseData = '';
$signature = '';
I see in the google LVL that there is a function called verify which has these parameters :
public void verify(PublicKey publicKey, int responseCode, String signedData, String signature);
But I don't undestand where this function is called and by what function.
Also I want to get this datas.
How can I do that ?
Thank you,
Yeah!! Same here!
Can someone tell us?
Most apps use client side license verification, don't know why... This would be very useful!
hello,
I'm working on a Vue-native project. I'm asking the question here because there is a limited community of developers using vue-native.
i'm working on a vue-native project where i need to create a hexadecimal to decimal and decimal back to hexadecimal converter. i have absolutely no clue about this numbering system. Is there any way I can create a converter in javascript or any other language?
Yes, pretty easily actually
JavaScript:
const base = 16;
let decNumber = 1234
let hexNumber = decNumber.toString(base)
console.log(hexNumber)
//"4d2"
typeof hexNumber
//"string"
and the other way around:
JavaScript:
const base = 16;
let hexNumber = "4d2"
let decNumber = parseInt(hexNumber, base)
console.log(decNumber)
//1234
typeof decNumber
//"number"
By changing "base" you can convert to other types:
JavaScript:
base = 2 //binary
base = 8 //octadecimal
base = 16 //hexadecimal
Thanks sir. This piece actually worked. I really appreciate it!..
denzelvieta said:
Thanks sir. This piece actually worked. I really appreciate it!..
Click to expand...
Click to collapse
istir said:
Yes, pretty easily actually
JavaScript:
const base = 16;
let decNumber = 1234
let hexNumber = decNumber.toString(base)
console.log(hexNumber)
//"4d2"
typeof hexNumber
//"string"
and the other way around:
JavaScript:
const base = 16;
let hexNumber = "4d2"
let decNumber = parseInt(hexNumber, base)
console.log(decNumber)
//1234
typeof decNumber
//"number"
By changing "base" you can convert to other types:
JavaScript:
base = 2 //binary
base = 8 //octadecimal
base = 16 //hexadecimal
Click to expand...
Click to collapse
Hello sir,
I just showed the answer to my client and this code does not return the correct answer for the large digits. For example, if i insert this number "1111111111111111" then this code returns "37450626705270707" which the actual answer is "1229782938247303441". My client gave me reference of this tool: https://binarytotext.net/hexadecimal-to-decimal/. Is there any way I can get the correct answer for the larger numbers?
There's nothing wrong with the code. Use Bignumber.js, it is used to handle big numbers in Javascript!!!
denzelvieta said:
Hello sir,
I just showed the answer to my client and this code does not return the correct answer for the large digits. For example, if i insert this number "1111111111111111" then this code returns "37450626705270707" which the actual answer is "1229782938247303441". My client gave me reference of this tool: https://binarytotext.net/hexadecimal-to-decimal/. Is there any way I can get the correct answer for the larger numbers?
Click to expand...
Click to collapse
I'm pretty sure this isn't an error in the code but rather "bug" in javascript.
As per this stackoverflow answer javascript uses IEEE-754 for storing numbers (which is mostly used for storing doubles, not integers). If you want to see what happens when you type in a really big number check out this tool (that's why you don't want to store eg. phone number as an integer).
This stackoverflow answer should probably give you a good idea what to do. This answer works for "1111111111111111".