string

Is there any way I can print String array without using for loop?

Is there any function in java like toString() to print a String array? This is a silly question but I want to know if there is any other way than writing a for loop. Thanks. ...

Python using doctest on the mainline

Hello i was wondering if it is possible and if so how? to do doctests or something similar from the mainline, instead of testing a function as is described in the doctest docs i.e. """ >>> Hello World """ if __name__ == "__main__": print "Hello" import doctest doctest.testmod() This is part of being able to test students...

string split in java

i have a string 004-034556. now i want to split in into two string. string1=004 string2=034556 that means the first string will contain characters before '-' and second string will contain characters after '-'. how to do it? i also want to check if the string has '-' in it. if not i will declare an exception. how to do? ...

Can a valid Unicode string contain FFFF? Is Java/CharacterIterator broken?

Here's an excerpt from java.text.CharacterIterator documentation: This interface defines a protocol for bidirectional iteration over text. The iterator iterates over a bounded sequence of characters. [...] The methods previous() and next() are used for iteration. They return DONE if [...], signaling that the iterator has reached t...

String index from line index and column index in NSString

Is there any easy way to get the string index in an NSString if I have the line number and column number? For example: myString = abc def ghi [myString getIndexFromLineNumber:2 columnNumber:1] should return the index of h in myString, so in this example it should be 10 (assuming new lines are 1 char long). ...

How to generate hebrew strings in python 3?

I'm trying to create hebrew strings but get syntax errors. It works in the IDLE shell but not in Pydev. Here's what I've tried so far: s = 'מחרוזת בעברית' #works in the shell only s = u'מחרוזת בעברית' #doesn't work at all s = unicode("מחרוזת בעברית", "UTF-8") #also doesn't work at all I get a syntax error: Non-UTF-8 code starting with...

How to handle ((List<string>)Session.Add("")

((List<string>)Session["answera"]).Add(xle.InnerText); I need to perform this operation, but I get "Object reference not set to an instance of...." I don't want to use List<string> ast = new List<string>(); ast.Add("asdas!"); Session["stringList"] = ast; List<string> bst = (List<string>)Session["stringList"]; as I mer...

C++: std::string problem

Hi again, I have this simple code: #include <iostream> #include <fstream> using namespace std; int main(void) { ifstream in("file.txt"); string line; while (getline(in, line)) { cout << line << " starts with char: " << line.at(0) << " " << (int) line.at(0) << endl; } in.close(); return 0; } wh...

Codedom and string handling

I've researched on this but couldn't find anything solid and wanted to see if someone can point me in the right direction. I'm trying to see if Codedom can handle strings and concantination between different languages, without me setting up conditional strings per language. For example, I need to generate the following exactly as shown ...

Filtering out a number at the start of a string which has a certain pattern.

Hi, I'm trying to filter a number out of a string if that string starts with @. Here's what I thought would do the trick, but it returns nothing more than a blank page. (May contain lots of mistakes as I'm new to PHP.) <?php $String = "@1234 Hello this is a message."; $StringLength = 1; Echo "Filtering the number after the @ out of " ...

Using fuzzing lib (python)

Hi Everyones, I'm trying to use this library : pastebin.com/xgPXpGtw (an example of use: pastebin.com/fNFAW3Fh) I have some issues since I dont want to split in an array all the byte as he does. My test script looks like this: import random from random import * def onerand(packet): pack = packet[:] byte = str(chr(choice(rang...

Java string value change in function

Hey guys, I have this very akward question... void changeString(String str){ str = "Hello world": } main(){ String myStr = new String(""); changeString(myStr); } When main returns the value is still "" and not "Hello world" Why is that? Also, how do I make it work? Lets say I want my function changeString to change the...

Java - Convert String to Uri

How can I convert a String to a Uri in Java (Android)? i.e.: String myUrl = "http://stackoverflow.com"; myUri = ???; ...

not able to convert bigdecimal to string in java

Hi guys, Here is the java code usageType = (String) c.getSrcValue("USAGETYPE"); c is a arraylist. I populate it with this field from DB. "USAGETYPE" NUMBER(*,0), I get the following error java.lang.ClassCastException: java.math.BigDecimal cannot be cast to String Can you please help me out ...

Unable to find a value for "length" in object of class "java.lang.String" using operator "."

Why does this JSTL expression not seem to be able to use the length method of the String class: <c:when test="${displayName != null && displayName.length > 0 }"> <p><c:out value="${displayName}"/></p> </c:when> It produces this exception: java.lang.RuntimeException: javax.servlet.ServletException: javax.servlet.jsp.e...

.NET format specifier for scientific notation with mantissa between 0 and 1

I am working with a Fortran program that expects floating point numbers to be input using Fortran's E format specifier, which is scientific notation, except the mantissa must be between 0 and 1. So instead of: "3147.3" --> "3.1473E3", it needs "3147.3" --> "0.31473E4". I am unable to modify the Fortran program, as it works with a ...

validating json string using javascript...

I have this json string {"Table" : [{"subject" : "No Records are there to Display"}]}. If i receive this data i want to alert NO Records Found. Any suggestion. Note: My key field may vary accordingly (ie) here it is Subject and some more like Details,Description. ...

string format in C#

I have value ranging from 1 to 10000000. After value 10000 i need to show values as 1E6,1E7,1E8,.... How to set this in string.Format ? Thanks to all for replying. Now i am able to display 1E5,1E6,1E7,....by using format "0.E0" but i dont want to set "E" from 1 to 10000. How to go about this ? ...

how to replace an element in every column of database table?

Hello, I am not a guru of databases, do most of the things through PHP, like data manipulation as well, even if it is an internal task. However, PHP is not being very useful in this case. I have a table with about 0.4 million records in it and it has like 16 columns, everything else works fine but I populated this table from a text file ...

Extract string between html tags in php

Hi, I want to extract string between html tags and convert it into other language using google api and to append the string with html tags. For example, <b>This is an example</b> I want to extract the string "This is an example" and convert it into other language and then again append the string with bold tag. Could anyone know how...