Get chars from string of numerals
here is what I would like to accomplish:
Put the last four integers of the systemDate into a variable so I can do some math with them.
Thanks.
Excellent. Thank you for the info. Very helpful.
Dewey
From: jchunick [email protected]
Sent: Friday, June 03, 2011 4:20 PM
To: Dewey Parker
Subject: Re: get chars from string of numerals
This is a post I made for the wiki which should help: http://director-online.com/dougwiki/index.php?title=Undocumented_Lingo#the_systemDate
Similar Messages
-
Delete a char from string ?
Hi,
I want to delete a char from string. i used the following function.
String f = formulla.replace('[','');
The above function doesnt work as it tells me to put a space or some char in 2nd parameter which i dont want. i just want to delete all occurences of some specific char in a string.
Any suggestion.
Thanks alot.u can do:
String before;
char charToReplace;
StringBuffer tempBuf = new StringBuffer(before);
for (int i=0; i<tempBuf.length(); i++)
if (tempBuf.charAt(i)==charToReplace)
tempBuf.deleteCharAt(i);
String after = tempBuf .toString(); HTH
Yonatan -
How to get substring from string using index?
hi,
here i am having string ,
i want the pullareddy from below line ,
i know how to get from substring.
but i want to get the above using "index",
can any help how to do it?
String str1="janapana,pullareddy, in malaysia";
jpullareddyget the start index with indexAt("pullareddy")
get the end index with adding the length of the word to the start
get the char[] of str1 with toCharArray()
make a new string with the chars from start to end index. -
How to get substring from string starting from the end of string
Hi
How to cut from string:
$A=C:\ClusterStorage\Volume1\WXP-plwropc300\Virtual Hard Disks\WXP-PLWROPC300_EE20E00F-315E-4781-A6DE-68497D4189B8.avhdx
this substring (name of VHD file): WXP-PLWROPC300_EE20E00F-315E-4781-A6DE-68497D4189B8.avhdx
This script should be universal so the best way to be cut all leters from the end of string $A till get the first mark \
Thank you for help.
Tomasz
Kind Regards TomaszPS > Split-Path 'C:\ClusterStorage\Volume1\WXP-plwropc300\Virtual Hard Disks\WXP-PLWROPC300_EE20E00F-315E-4781
-A6DE-68497D4189B8.avhdx' -leaf
WXP-PLWROPC300_EE20E00F-315E-4781-A6DE-68497D4189B8.avhdx
PS >
That is what "Split-Path" is for:
¯\_(ツ)_/¯ -
How to get InputStream from String ?
Hi !
I want to get InputStream object from String.
String str = "balabalabala";
InputStream stream = getInputStream(str);
How to realize getInputStream(str) function ?
Thanks!The preferred method nowadays is to use Readers and Writers for String data - hence StringReader(String). If you're going to operate on the InputStream directly, then I'd modify your code to use the Reader calls and go that route.
If, however, you need to pass the InputStream to some other piece of API that requires an InputStream instead of a Reader, then the ByteArrayInputStream is probably your best bet. StringBufferInputStream is deprecated because it doesn't work reliably in the face of many character encodings.
Speaking of encodings - never call Strng.getBytes() - always use the getBytes(character-encoding) version, so you KNOW what encoding you're getting!
Grant -
VB.net
I need to get the third and forth item from a string. The string varies in items within delimiter and total number of delimiters.
My delimiter is :
MyString = "ALL:0:Red:11Green:31:Blue:217"
MyItems = "Red:11"
Also, if elements 3 and 4 are not there, messagebox.show("Items don't exist.")
Thanks,
ADawn
ADawnThere is a : between 11 and Green.
"ALL:0:Red:11:Green:31:Blue:217"
ADawn
ADawn
Then it's even easier.
Option Strict On
Option Explicit On
Option Infer Off
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim s As String = "ALL:0:Red:11:Green:31:Blue:217"
Dim parts As List(Of String) = s.Split(":"c).ToList
Dim allLabel As String = parts(0)
Dim allValue As String = parts(1)
Dim redLabel As String = parts(2)
Dim redValue As String = parts(3)
Dim greenLabel As String = parts(4)
Dim greenValue As String = parts(5)
Dim blueLabel As String = parts(6)
Dim blueValue As String = parts(7)
MsgBox(String.Format("{0}:{1}", redLabel, redValue))
End Sub
End Class
“If you want something you've never had, you need to do something you've never done.”
Don't forget to mark
helpful posts and answers
! Answer an interesting question? Write a
new article
about it! My Articles
*This post does not reflect the opinion of Microsoft, or its employees. -
Hi,
I have a problem with an select.
I need to compare two string columns. First column includes only a number with 9 characters:
'001234567'
Second column includes text where somewhere inside this text is the number 001234567.
'Hallo1 001234567'
I need to extract the 9 character big number out of the string. I thought using the regular expression feature could help me.
SELECT
REPLACE(REGEXP_REPLACE('hallo 001122334', '[a-z]', ''),' ') "REGEXP_REPLACE"
FROM dual;But this would exclude the number 1 after Hallo:
Result: '1001234567'
The number I look for is always 9 character long.
Thanks ahead,
TobiasYou have many variants:
with your_table as
(select
'hallo1001122334' first_column,
'001122334' second_column
from dual
select *
from your_table
where
--1) regexp_like(first_column,'.*'||second_column||'$')
--2) first_column like '%'||second_column
--3) regexp_substr(first_column,'\d{9}$')=second_column
--4) regexp_replace(first_column,'\D','') like '%'||second_columnFourth variant - includes case when chars can be between numbers in first column (for example 'hallo100a1a1a2a2a3a3a4'). -
Help on getting value from string
Hello can someone please help me with my code?
I would like to know how to get a value in a string as an integer type
This is what I have so far
String x = "12345";
for(int f=0; f<5; f++){
int c = stringDigits.charAt(f);
sum += c;
However the sum does not turn out to be 1+2+3+4+5 = 15 because the value of c will always turn out to be 48 more than it is supposed to be
for example when f = 1 then c would = 49
f = 2 then c would = 51
Thank you very much for your helpint i = Integer.parseInt(x);
Will convert the String to an integer.The original poster was looking for a way to convert a single digit in a string to its numeric value, not to convert the whole string to an integer.
I forgot to mention that this is contained in the
java.text package, so you will need to
import java.text.*;Integer is in the java.lang package, so no import is necessary. -
Can we get Arraylist from String.Please check the code
Hi all,
I have just pasted my code over here.Can anyone of you find the solution for obtaining the Array list from the String.
For Example :
ArrayList al = new ArrayList();
al.add(new byte[2]);
al.add("2");
String stringVar = "" + (ArrayList) al;
Here I can convert the arraylist into string.But can we do he vice versa like obtaining the above arraylist from the string?If please advice me.
URGENT!!!!cudIf you run the code you posted you will observe that the string form of the list does not contain all the information of the list: in particular the array elements are missing. It follows that the "vice versa" conversion you seek is simply not possible.
A variation on this theme is the following:import java.util.ArrayList;
public class ListEg {
public static void main(String[] args) {
ArrayList al = new ArrayList();
al.add("foo");
al.add("bar, baz");
String stringVar = "" + (ArrayList) al;
System.out.println(stringVar);
}If you think about the output you should be able to conclude that lists with different contents can easily have the same string form.
Just something to chew on. -
Get path from string in an column
I have an data with text and url. I need to seprate the url only in the column and display in sql query
Need to get data after Url: and the next immediate " " {blank space}
my data is like below
seach engine Url: www.bing.com this is the world famous search enging
mail box Url: www.hotmail.com email is free
microsoft webstie Url: http:\\microsoft.com the home page of microsoft.
ShanmugaRajTry the below:
Create table Test_Shan(Textstring Varchar(1000))
Insert into Test_Shan Values ('seach engine Url: www.bing.com this is the world famous search enging'),
('mail box Url: www.hotmail.com email is free'),
('microsoft webstie Url: http:\\microsoft.com the home page of microsoft.')
Select substring(LTRIM(stuff(Textstring,1,CHARINDEX('Url:',Textstring)+4,' ')),0,charindex(' ',LTRIM(stuff(Textstring,1,CHARINDEX('Url: ',Textstring)+4,' ')),0))
From Test_Shan -
I have a String contains records seperated by tab.How cani break up into individual record and get them
Bill Mor 1234 US-TEXAS 56
John Cruz 4567 UK-EDH 45
I need
Bill Mor
1234
US-TEXAS
56
then
John Cruz
4567
UK-EDH
45String[] splitLine = line.split("\t");
-
hi , I have some like
String quesFour=req.getParameter("quesFour");
String quesFive=req.getParameter("quesFive");
String quesSix=req.getParameter("quesSix");
String quesSeven=req.getParameter("quesSeven");
String quesEight=req.getParameter("quesEight");
String quesNine=req.getParameter("quesNine");
String quesTen=req.getParameter("quesTen");
String quesEleven=req.getParameter("quesEleven");
every question in form have radio relate to it
<table ><tr><td width="30px"> <input type="radio" name="quesTwo" value="0">0</td>
<td width="30px"> </td>
<td width="40px"><input type="radio" name="quesTwo" value="1">1</td>
<td> </td>
<td colspan="3" width="50px"><input type="radio" name="quesTwo" value="2">2</td>
<td> </td>
<td colspan="3" width="50px"><input type="radio" name="quesTwo" value="3">3</td>
</tr></table> after the user submit a form , I want to get totaly point they have, how to do it? thak youHJava wrote:
hi , I have some like
String quesFour=req.getParameter("quesFour");
String quesFive=req.getParameter("quesFive");
String quesSix=req.getParameter("quesSix");
String quesSeven=req.getParameter("quesSeven");
String quesEight=req.getParameter("quesEight");
String quesNine=req.getParameter("quesNine");
String quesTen=req.getParameter("quesTen");
String quesEleven=req.getParameter("quesEleven");
Integer.parseInt(String value)If you want to make this more "dynamic" then you could have an array of questions and have form elements named things like
<radio name="q_0"
<radio name="q_1"etc and then in your code have
for(int i=0,i<something;i++){
req.getParameter("q_"+i);
} -
My Table Column have below data
COLUMN A
Name of my Country is India
I am from Country Japan
My Country is China
How to get result as below
"Country is India"
"Country Japan"
"Country is China"
ShanmugaRajTry:
DECLARE @t TABLE (Info VARCHAR(300));
INSERT INTO @t (Info)
VALUES ('Name of my Country is India')
,('I am from Country Japan')
,('My Country is China')
,('Testing');
SELECT Info
,substring(Info, NULLIF(charindex('Country', Info), 0), LEN(Info)) AS [Country Info]
FROM @t;
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles -
hi,
i have field like that 12-3456
and i wont to delete '-' to have 123456
what is the best way to do that?
RegardsHi,
TRANSLATE field USING '- '.
CONDENSE field NO-GAPS.
The TRANSLATE command replaces al '-' with blanks and the CONDENSE, NO-GAPS compresses the string to remove all spaces/blanks.
Cheers,
Aditya -
Regular expression to get substring from string
Hi,
I’m having the following problem:
SELECT REGEXP_SUBSTR(';first field;ir-second field-02;ir-second field-01; third field','.*ir-(.*)-01.*’)FROM dual
[\CODE]
This is the select that I have with a java expression!
In java I’m able to do find the right expression to retrieve what I want, but I don’t know how to adapt this for oracle!
In oracle I was trying to do something like this:
NVL(SUBSTR(REGEXP_SUBSTR(CONCAT(';', list),';ir-[^01;]+'),LENGTH(';ir-')+1,LENGTH(REGEXP_SUBSTR(CONCAT(';',list),';ir-[^01;]+'))), ' ') AS result
[\CODE]
But it doesn’t work because “ir” can repeat in other parameters.
“ir-something-01” only appears once.
Is it in oracle a logic similar to result groups in oracle?
best regards,
Ricardo Tomásrctomas wrote:
Hi,
In java I’m able to do find the right expression to retrieve what I wantWell, would be nice to tell us what that right expression would be :). Anyway, is this what you are looking for:
SQL> SELECT REGEXP_SUBSTR(';first field;ir-second field-02;ir-second field-01; third field',';ir-([^;]*)-01')
2 from dual
3 /
REGEXP_SUBSTR(';FIR
;ir-second field-01
SQL> SY.
Maybe you are looking for
-
Frame 7.2 and InDesign CS3 Distiller conflict
I am using Frame 7.2b128, Distiller 7.0. I recently installed InDesign CS3, which uses Distiller 8.0. Whenever I work in InDesign and create a final PDF, and then go back to working in Frame and generate a PDF by using Save As ..PDF (working in a boo
-
XMLParserv2 9.2.0.4.0 vs 9.0.3.0.0
does anyone know if there are any implementation changes between these two versions of XMLParserV2? We know that 9.0.3 ships with 9iAS 9.0.3 and the other is part of the XDK. We've noticed some glitches in our application, which was programmed using
-
Subject: DBMS_LDAP get ORA-06502 and ORA-06512 error msgs I used DBMS_LDAP in PL/SQL procedure and am getting the following error msgs. Could anyone help? ORA-06502: PL/SQL: numeric or value error ORA-06512: at "SYS.OWA_UTIL", line 315 ORA-06512: at
-
Where do I download Oracle ESB 10.1.3.4 for solaris sparc?
Hi, Where can I download Oracle SOA Suite ESB 10.1.3.4(only ESB, BPEL is not required). I could find the following link: http://www.oracle.com/technology/software/products/ias/htdocs/101310.html which has Oracle Enterprise Bus 10g (10.1.3.1.0). What
-
Simple Applet not running in ie 5
Hi I have built a simple applet consisting of 4 classes, The button panel, and three listener classes. When I run this from the command line it works fine, and presents me with a grey panel (100 * 180) and the three buttons are drawn onto the applet