Intention is to take a current line which contains commas, store trimmed values of all space and store the line into the array.
Why does this not work?
String[] currentLineArray = currentInputLine.replace("\\s", "").split(",");
I want to capitalize the first character of a string, and not change the case of any of the other letters. For example:
this is a test - This is a test
the Eiffel Tower - The Eiffel Tower
/index.html - /index.html
I have a string like
Pakistan, officially the <a href="Page.aspx?Link=Islamic Republic of Pakistan">Islamic Republic of Pakistan</a>
Now I am using
System.Text.RegularExpressions.Regex.Replace(inputText, "(\\bPakistan\\b)", "something");
to replace Pakistan outside the tags. But I don't want to replace Pakistan occurring within the <a></a> tags.
Hello,
I have this string: '30/05/2010', and I would like to enter it to a smallDatetime field.
In the database it should look something like this 2010-05-30 15:33:25
Any Idea how?
TY
I am very much new to android so need some good help with a code example.
I am getting a date in form of string from a server in the following format
2012-08-17 00:00:00
I want to compare this string with current date to find the difference between the dates in the form of year, months and days...
I tried playing around it in the following code
Date currentDate = new Date(System.currentTimeMillis());
Log.v("@@@@@@@@@","Current Date: " + currentDate);
Date passDate = new SimpleDateFormat().parse(passDateString);
Log.v("@@@@@@@@@","Pass Date: " + passDate);
dateDifference = passDate.compareTo(currentDate);
but it returned with following exception
04-15 12:08:29.101: V/@@@@@@@@@(1161): Current Date: Sun Apr 15 12:08:29 GMT+01:00 2012
04-15 12:08:29.101: W/System.err(1161): java.text.ParseException: Unparseable date: 2012-08-17 00:00:00
04-15 12:08:29.111: W/System.err(1161): at java.text.DateFormat.parse(DateFormat.java:645)
04-15 12:08:29.111: W/System.err(1161): at org.apis.PassesListItemAdapter.getView(PassesListItemAdapter.java:77)
04-15 12:08:29.111: W/System.err(1161): at android.widget.AbsListView.obtainView(AbsListView.java:1315)
04-15 12:08:29.111: W/System.err(1161): at android.widget.ListView.makeAndAddView(ListView.java:1727)
04-15 12:08:29.111: W/System.err(1161): at android.widget.ListView.fillDown(ListView.java:652)
04-15 12:08:29.111: W/System.err(1161): at android.widget.ListView.fillFromTop(ListView.java:709)
04-15 12:08:29.111: W/System.err(1161): at android.widget.ListView.layoutChildren(ListView.java:1580)
04-15 12:08:29.111: W/System.err(1161): at android.widget.AbsListView.onLayout(AbsListView.java:1147)
04-15 12:08:29.111: W/System.err(1161): at android.view.View.layout(View.java:7034)
04-15 12:08:29.111: W/System.err(1161): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:909)
04-15 12:08:29.111: W/System.err(1161): at android.view.View.layout(View.java:7034)
04-15 12:08:29.111: W/System.err(1161): at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
04-15 12:08:29.111: W/System.err(1161): at android.view.View.layout(View.java:7034)
04-15 12:08:29.111: W/System.err(1161): at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
04-15 12:08:29.111: W/System.err(1161): at android.view.View.layout(View.java:7034)
04-15 12:08:29.111: W/System.err(1161): at android.view.ViewRoot.performTraversals(ViewRoot.java:1049)
04-15 12:08:29.111: W/System.err(1161): at android.view.ViewRoot.handleMessage(ViewRoot.java:1744)
04-15 12:08:29.111: W/System.err(1161): at android.os.Handler.dispatchMessage(Handler.java:99)
04-15 12:08:29.111: W/System.err(1161): at android.os.Looper.loop(Looper.java:144)
04-15 12:08:29.111: W/System.err(1161): at android.app.ActivityThread.main(ActivityThread.java:4937)
04-15 12:08:29.111: W/System.err(1161): at java.lang.reflect.Method.invokeNative(Native Method)
04-15 12:08:29.111: W/System.err(1161): at java.lang.reflect.Method.invoke(Method.java:521)
04-15 12:08:29.111: W/System.err(1161): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-15 12:08:29.111: W/System.err(1161): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-15 12:08:29.111: W/System.err(1161): at dalvik.system.NativeStart.main(Native Method)
I am stuck... please help
Raj
Hi all.I am trying to get date format from Day name and time like "Monday" and second string "08:15" and it must like 10:05:2010 08:15 and then I will make subtracting from date of today. DateTime.Parse("08:15") it works but it outputs todays date. I want to get date of day name. I also usedDateTime.Parse("08:15").AddDays(1)it gaves me next days date.Here I want to get date of next Monday with and "08:15" time.
Hello guYz plz help me out in making it possible to open the files by the adress provided in an array of strings.........
a way to open file is as given below...
ifstream infile;
infile.open("d:\aslam.txt");
but how can i open file providing an array of string as an adress of file.....
like this
infile.open(arr[i]); (but its not working)
plz help me.........
In python:
s = '1::3'
a = s.split(':')
print a[0] # '1' good
print a[1] # '' good
print a[2] # '3' good
How can I achieve the same effect with zsh?
The following attempt fails:
s="1::3"
a=(${(s/:/)s})
echo $a[1] # 1
echo $a[2] # 3 ?? I want an empty string, as in Python
Is there any alternative to this:
Organizations.Include("Assets").Where(o => o.Id == id).Single()
I would like to see something like:
Organizations.Include(o => o.Assets).Where(o => o.Id == id).Single()
to avoid the hard-coded string "Assets".
Using Python I need to delete all charaters in a multiline string up to the first occurrence of a given pattern. In Perl this can be done using regular expressions with something like:
#remove all chars up to first occurrence of cat or dog or rat
$pattern = 'cat|dog|rat'
$pagetext =~ s/(.*?)($pattern)/$2/xms;
What's the best way to do it in Python?
for(int i = 1;i<100;i++)
string strI = i.tostirng();
in here, if i is 1 then strI is '1'
But I want to get '01'
or '001'
it looks quite easy. but there's only article about datetime.tostring("yyyy-MM-dd") :(
How can we get the numbers 7 and 4 and 5 from the following string:
MODULE potmtpMAIN main
<info: "Enterprise Optimizer 7.4 for COR Technology 5.5 -- Advanced Solver Edition", url:"http://EO.riverlogic.com", url_menu:"EO Online...", app_id:"EOAS",app_name:"Enterprise Optimizer AS", **app_major:7**, **app_minor:4**,**app_micro:5**,app_copyright:"\251 1996-2010 River Logic Inc.\r\nAll Rights Reserved.">
Thank You in advance
folks, i have a string like
AxxBCyyyDEFzzLMN
I want to replace all x and y and z with _ so that the output is
A_BC_DEF_LMN
How to do that?
I know a series of tr 'x' '' | tr 'y' '' will work, but I want to do taht in one go, without using pipes
thanks in advance
Hi,
How can i print only certain words from a string in python ?
lets say i want to print only the 3rd word (which is a number) and the 10th one
while the text length may be different each time
mystring = "You have 15 new messages and the size is 32000"
thanks.
I want to convert an int to a string but if it is a single digit I want to add a leading 0
Is that one of the built in format options? or do I have to do it manually?
var_dump('<a>')
// or
var_dump("<a>")
// or
var_dump("\x3Ca>")
// all result in
string(3) ""
What is going on? Only putting a space after the less-than sign works for me.
PHP Version 5.2.10-2ubuntu6.4
The post office actually publishes a list of commonly used street suffixes in addresses:
http://www.usps.com/ncsc/lookups/abbr_suffix.txt
I want to take this list and make a ruby function that takes a string, takes the last word ("183 main strt".split[' '].last) and if it matches any of the commonly used street suffixes ("strt"), replace it with the official Postal Service Standard Suffix ("st").
Is there a better way to approach this than a massive str.sub.sub.sub.sub.sub?
I have a list of
uids: ['1234','4321','1111']
and I would like to turn this into a single string of:
"uid = '1234' OR uid = '4321' OR uid = '1111'"
What's the most efficient way to do this?
Thanks!
I am working with ruby 1.8.6 (2007-03-13 patchlevel 0) [x86_64-linux] and I get
undefined method `bytes' for #<String:0x2a95ec2268> (NoMethodError)
even though my code works on ruby 1.8.7. patchlevel 249
I saw somewhere that you need to add require "jcode" for a similar method not defined error with each_byte. I tried adding that but it still does not work. Any suggestions are very appreciated.