[Solved] Javascript remove leading zeros and decimal points from string [closed]

You could try the below string.replace function. Use ^ to tell the regex engine to do the matching operation from the start. By putting 0 and . inside a character class would match either 0 or dot. string.replace(/^[0.]+/, “”) Example: > “0.015.000”.replace(/^[0.]+/, “”) ‘15.000’ > “0.150.000”.replace(/^[0.]+/, “”) ‘150.000’ > “015.000”.replace(/^[0.]+/, “”) ‘15.000’ 0 solved Javascript … Read more

[Solved] Merging several strings in PHP [closed]

Give that a go, Works for me <?php $test = array(); $test[]=”serverA”; $test[]=”serverA.something.com”; $test[]=”serverA”; $test[]=”serverB”; $test[]=”serverB.something.com”; $test[]=”serverC”; $test[]=”serverD.something.com”; sort($test); $final = array(); $temp = “#”; for($i=0,$count = count($test);$i<$count;$i++){ if(substr( $test[$i], 0, strlen($temp) ) == $temp) $temp = $test[$i]; else { $final[] = $temp; $temp = $test[$i]; } } //unset first unset($final[0]); //add in last $final[] … Read more

[Solved] tags with class in html [closed]

since the B tag is semantically meaningless in HTML5 (look it up), i don’t mind “abusing” it for on-screen purely-presentational formatting of existing content: <style> b{ font-weight: normal; font-family:…; color:…;…} </style> normal text <b> math text </b> normal text this reduces your overhead from “<span class=”mymath”></span>” to “<b></b>” which is quite a bit shorter. technically, … Read more

[Solved] Interface vs Abstract Class (general OO)

While your question indicates it’s for “general OO”, it really seems to be focusing on .NET use of these terms. In .NET (similar for Java): interfaces can have no state or implementation a class that implements an interface must provide an implementation of all the methods of that interface abstract classes may contain state (data … Read more

[Solved] How to fetch database values between two dates [closed]

Here it is Method body public void callDatabase(String date1, String date2){ PreparedStatement stmt=con.prepareStatement(“select absentdt, period from stu_attendancemaster where classid=70 AND absentdt BETWEEN ‘”+date1+”‘ AND ‘”+date2+”‘ “); ResultSet rs=stmt.executeQuery(); while(rs.next()) { //get data here } } Method call String d1,d2; //initialize callDatabase(d1,d2); 3 solved How to fetch database values between two dates [closed]

[Solved] How to replace several characters on a single string to desired characters (java)?

public class TranslateChar { /** @param args */ public static void main(final String[] args) { final Map<Character, Character> mapCharCod = new HashMap<>(36); final Map<Character, Character> mapCharDecod = new HashMap<>(36); mapCharCod.put(‘A’, ‘Z’); mapCharCod.put(‘B’, ‘X’); mapCharCod.put(‘C’, ‘Y’); mapCharDecod.put(‘Z’, ‘A’); mapCharDecod.put(‘X’, ‘B’); mapCharDecod.put(‘Y’, ‘C’); final String toCod = “CAB”; StringBuilder sb = new StringBuilder(“{“); for (final char c … Read more

[Solved] how can I Convert NSMUtableArray to NSString [closed]

As per Hot Licks comment you can use below code. bookArray = [[NSMutableArray alloc] init]; [bookArray addObject:@”Book A”]; [bookArray addObject:@”Book B”]; Then use Below code. NSString *yourString=[bookArray description]; if you want to use NSMutableString and Some different separator then use Below Code. NSMutableString* content = [NSMutableString string]; for (int aa=0; aa < [bookArray count]; aa++){ … Read more