Is there a Java equivalent to Ruby's Array#product method, or a way of doing this:
groups = [
%w[hello goodbye],
%w[world everyone],
%w[here there]
]
combinations = groups.first.product(*groups.drop(1))
p combinations
# [
# ["hello", "world", "here"],
# ["hello", "world", "there"],
# ["hello", "everyone", "here"],
# ["he...
I have a problem with the function replace. What I want to accomplish is to replace some special characters, but I haven't written the code yet. So in the replace function we can at this moment just say that the function should print line for line the way I have tried to write. Can someone please correct this function? I can’t really get...
I'm writing program in C# for converting between model formats.
The model format has numbers as text such as "-0.136222".
I can use System.Convert.ToSingle() to convert this to a floating point number. But here in Germany we use commas as decimal points (-0,136222), and System.Convert picks up on this. Now I have the problem of it not r...
How do I concenate 2 strings in objective-c, like in VB.net you can just do "foo" & "bar"
...
Hi.
I'm trying to get Mako render some string with unicode characters :
tempLook=TemplateLookup(..., default_filters=[], input_encoding='utf8',output_encoding='utf-8', encoding_errors='replace')
...
print sys.stdout.encoding
uname=cherrypy.session['userName']
print uname
kwargs['_toshow']=uname
...
return tempLook.get_template(page).re...
I am working on a software project and have written a validation system to help prevent theft of the software. I was reading back through the code, and found a huge "loophole" that could potentially allow the motiviated users to copy the program and install it without even contacting the activation server. So, I modified the program and ...
Generally, i want do do some operations to some vars in a loop, the number of vars may change, i tried a sample like this:
set header1=appdef1.h
set header2=appdef2.h
set header3=appdef3.h
set headers= "%header1% %header2% %header3%"
for /f "delims= " %%i in (%headers%) do echo %%i
pause
while it only output "appdef.h", confusing!
...
I've tried searching for this, but most people just want to convert hex values into their ascii equivalents. That's not what I am looking todo.
I'm looking to see if vb.net has a simple built in function to do this:
Private Function NibbleToString(ByVal Nibble As Byte) As String
Dim retval As String = String.Empty
Select...
I have a class I wrote in Java and one of the methods is getCommand()
The purpose of this method is to read in a string and see what the user typed in matches any of the acceptable commands.
This is how I wrote it initially:
public char getCommand(){
System.out.println("Input command: ");
command = input.nextLine();
whi...
Alright, Im going about this, with what is probably a really complicated solution, but its the first thing that popped into my head.
I need to write an assembly language program that reverses a "source" string, without using a "target" string ( a temp variable ) .. this is my attempt at it.
INCLUDE Irvine32.inc
.data
source BYTE "Thi...
Hello,
I have imported date&time data from a text file, in which it was stored as a string, to Matlab. I can convert string to numeric data and back, by using datenum and datestr commands.
My problem is with creating figures. I can easily plot data against numeric date&time values, but as it is stored as a number, it is not very useful...
Hi,
I have always wondered what the most effective way is of creating String's in Java. By this I mean strings that won't change in value.
Example:
String prefix = "Hi, I am ";
The prefix won't change but the postfix might.
I don't want to make the prefix a static final variable as it will always stay alive in the JVM even if the ...
When printing a formatted string with a fixed length (e.g, %20s), the width differs from UTF-8 string to a normal string:
>>> str1="Adam Matan"
>>> str2="אדם מתן"
>>> print "X %20s X" % str1
X Adam Matan X
>>> print "X %20s X" % str2
X אדם מתן X
Note the difference:
X Adam Matan X
X אדם מתן X
Any i...
I am basically looking for the Python equivalent to this VB/VBA string operation:
FullName = LastName & ", " + FirstName
In VB/VBA + and & are both concatenation operators, but they differ in how they handle a Null value:
"Some string" + Null ==> Null
"Some string" & Null ==> "Some string"
This hidden feature allows for the first l...
Hi guys,I have a text with mixed languages, (one LTR and the other RTL).when sending the string on SMTP the string gets mixed up .Is there any way to recognize the string ?
...
Is there any function in Javascript for formatting number and strings ?
I am looking for a way for thousand separator for string or numbers...
(Like String.Format In c#)
...
i have a variable with string type.for example string test;.how many character i can set for test?thanks.
...
Developing a little survey webapp, ran into problem that deals with ranges for rating type questions.
So a rating's range could be:
1..10
-5..0
-5..5
'a'..'z'
'E'..'M'
and so on
The range is stored as a pair of varchars in database (start and end of range). So range always starts off as a string input.
What is the best way to take t...
Is there an equivalent to the .NET/C#'s String.Format in Java?
...
So I have this foreign namebank in a textfile that I read from and throw into a data table.
The "string" datatype doesn't recognize the foreign letters. I am using a textreader/streamreader to read the text file line by line (one line per name)
What is in the textfile -> What shows up in the database(traced it to the string)
Szilveszte...