[Solved] c++ Check if string is valid Integer or decimal (both negative and positive cases)

The answer was a simple Regex: bool regexmatch(string s){ regex e (“[-+]?([0-9]*\.[0-9]+|[0-9]+)”); if (regex_match (s,e)) return true; return false; } It will return true on integers (i.e. 56, -34) and floating point numbers (i.e. 6.78, -34.23, 0.6) as expected. 3 solved c++ Check if string is valid Integer or decimal (both negative and positive cases)

[Solved] Java! How to go to the specific line?

Place the body of your code that you want repeating inside a while loop and break when your end-condition is true: public static void main(String[] args) { while(true) { Scanner input = new Scanner(System.in); userinput: System.out.println(“Enter you name:”); String name = input.nextLine(); System.out.println(“OK! Now enter your age:”); int age; age = input.nextInt(); System.out.println(“Good! And the … Read more

[Solved] To convert a group of meaningful words in short form

import java.io.*; class mdae { public static void main(String[] args)throws IOException { InputStreamReader cr = new InputStreamReader(System.in); BufferedReader in = new BufferedReader(cr); int i, oy,l; String s,q,ioo=” “; char c,v; s=in.readLine(); s=s.replaceAll(“of”,””); q=” “+s+” “; l=q.length(); for(i=0;i<l-1;i++) { c=q.charAt(i); if(c==’ ‘) { for(oy=i;oy<=i+1;oy++) { v=q.charAt(oy); if(v!=’ ‘) { ioo=ioo+v; } } } } System.out.print(ioo); } … Read more

[Solved] Javascript Grammar Checking

This is probably roughly what you’re looking for: if (screen.width >= 800) { var redirect = confirm(“You are on the mobile site. Would you like to visit our full site instead?”); if (redirect) { window.location.href=”http://TEXTHIDDEN.com/”; } } You should invest some time in learning some javascript basics, and use tools like JSLint to check your … Read more

[Solved] ArrayList strange behaviour [closed]

Your arraylist is a static variable inside your class.So there is only one arraylist in memory.Each time you call the song method , you are modifying the same list.That means your latest_songs,top_songs,hit_songs, all will be pointing to same list.That is the reason your list is getting over ridden. Try creating a list inside your method … Read more

[Solved] Java : Total downloading time [closed]

Something like the below may be feasible here: long a = System.nanoTime(); //Do your stuff System.out.println(“Total time taken: ” + System.nanoTime() – a); 2 solved Java : Total downloading time [closed]

[Solved] C# If i click button2 (in form2) , label1 show in form 1 [closed]

Add this code to Form1’s button click, private void button1_Click(object sender, EventArgs e) { Form2 from2 = new Form2(); Control[] button = from2.Controls.Find(“button1”, true); button[0].Click += new EventHandler(ShowLabel); from2.ShowDialog(); } Add this Form1 too (Set the WORK label’s visible property to false under properties) private void ShowLabel(object sender, EventArgs e) { label1.Visible = true; //Setting … Read more

[Solved] Parse JSON array of objects in Objective C [closed]

for(NSDictionary * dict in ezpoints) { [userPrivacyArray addObject:[dict valueForKey:@”user_privacy”]]; [LattitudeArray addObject:[dict valueForKey:@”latitude”]]; [LongitudeArray addObject:[dict valueForKey:@”longitude”]] } parse the data using valueForKey using key you can identify your json data and stored into NSArray, NSString where you want. here userPrivacyArray,LattitudeArray,LongitudeArray all are array. try this stuff. 3 solved Parse JSON array of objects in Objective C … Read more

[Solved] Query MySQL on PHP [closed]

try to remove the simple quotes in your printf: $row[‘id_region’] becames $row[id_region] but I suggest you this to be sure: echo ‘<td>’.$row[‘id_region’].'</td>’; Also, please consider using mysqli instead of mysql, as it’s deprecated <?php $dbhost=”…………”; $dbuser=”……..”; $dbpass=”…….”; $dbname=”db_site”; $my = new Mysqli($dbhost, $dbuser, $dbpass, $dbname); ?> <h4><center>Title</center></h4> <table border=”2″ cellspacing=’0′ cellpadding=’0′> <tr> <td>id</td> <td>id_site</td> <td>id_mast</td> … Read more