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";
jpullareddy
get 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.
Similar Messages
-
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 extract substring from string... how to find the index?
suppose i have a string like
"string1 string2 string3 string4 string....stringK...stringN"
i would like to extract the substring from string4 to stringK-1
where stringK and string3 are pre defined strings (ie, i know exactly what stringK and string3 is).
is there a function to extract the substring from string4 to stringK-1
or is there a function i can use to determine the index of the end of string4 and the start of stringK?
thks!If your substrings are seperated by a space (or by any other character that isn't used in any of the substrings), you could use something like StringTokenizer.
If you wanna get real fancy, use the split method of String. -
Help , How to get data from database using recordset with UI API
I want to get a data from database
when I want to create recordset i notice that UI API didn't has record set
so I created recordset using DI API (SAPbobscom.recordset and SAPbobscom.company)
======================================================
Dim oCompanyUI As SAPbouiCOM.Company <<UI API
Dim oRecSet As New SAPbobsCOM.Recordset << DI API
Dim oCompanyDI As New SAPbobsCOM.Company << DI API
'=====================================================
oCompanyDI.Connect
Set oRecSet = oCompanyDI.GetBusinessObject(BoRecordset)
oRecSet.DoQuery ("SELECT T0.CardCode, T0.CardName FROM OCRD T0")
SBO_Application.MessageBox oRecSet.Fields.Item(1).Value
======================================================
but I got an error it said "you are not connected to company"
I'm really don't have an idea about how to get a data from using UI API (exp I want to get a date or costumer code)
can someone help me please, I really need it
Thanksyou need a single sign on
Dim oDICompany As SAPbobsCOM.Company
Dim sCookie As String
Dim sConnStr As String
Dim ret As Integer
oDICompany = New SAPbobsCOM.Company
sCookie = oDICompany.GetContextCookie
sConnStr = SBO_Application.Company.GetConnectionContext(sCookie)
If oDICompany.Connected Then
oDICompany.Disconnect()
End If
ret = oDICompany.SetSboLoginContext(sConnStr)
If Not ret = 0 Then
SBO_Application.MessageBox("set Login Context failed!")
Exit Sub
End If
ret = oDICompany.Connect()
If Not ret = 0 Then
SBO_Application.MessageBox("Company Connect failed!")
End If -
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 -
How to iterate a CSV String using Index
Hi Team
I have a CSV String. I need to iterate through the string and use Index to address to a particular element in String. I have used Split String activity but it just runs in the For Loop to get the values.
I need to have the provision to take 'i' th element using an index which I can run in the loop.
In other words, could I have the provision of array definition in CPO and refer any 'i' th position in the array using an index
ThanksHi, Shankar!
Using the XSL Transform activity in the product with the XSLT below you should be able to convert your comma-separated string into a XML that can be read into a table with 2 columns (Idx and Value, where Idx is the numeric number of the row).
The XML produced by the XSL Transform activity could be read into a table using Read Table from XML activity.
The XSL is expecting that you will put your string into tag.
<?xml version="1.0"?>
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
Svetlana -
How to get data from Oracle using Native SQL in SAP.. Problem with date
Hi Masters.
I'm trying to get data from an Oracle DB. I was able to connect to Oracle using tcode DBCO. The connetion works fine
I wrote this code and it works fine without the statement of where date > '01-09-2010'
But i need that statement on the select. I read a lot about this issue, but no answer.
My code is (this code is in SAP ECC 6.0)
DATA: BEGIN OF datos OCCURS 0,
id_numeric(10),
component_name(40),
comuna(10),
record_id(10),
status,
sampled_date(10),
END OF datos.
DATA: c TYPE cursor.
EXEC SQL.
connect to 'LIM' as 'MYDB'
ENDEXEC.
EXEC SQL.
SET CONNECTION 'MYDB'
ENDEXEC.
EXEC SQL PERFORMING loop_output.
SELECT ID_NUMERIC, COMPONENT_NAME, COMUNA, RECORD_ID, STATUS, SAMPLED_DATE
into :datos from lims.SAMP_TEST_RESULT
where date > '01-09-2010'
ENDEXEC.
EXEC SQL.
disconnect 'MYDB'
ENDEXEC.
How can i get the data from that date?? If i delete the where statemet, the program works well, it takes 30 mins and show all the data, I just need the data from that date.
Any help
RegardsPlease refer the example in this link which deals with Oracle date format.
You can finnd a command DECODE which is used for date formats. If you have a look at whole theory then you will get an idea.
Link:[Bulk insert SQL command to transfer data from SAP to Oracle|http://sap.ittoolbox.com/groups/technical-functional/sap-dev/bulk-insert-sql-command-to-transfer-data-from-sap-to-oracle-cl_sql_connection-3780804] -
How to get data from bean using selectmanycheckbox
Am not able to understand how to get selectmanycheckbox data of datatable from backing bean
help me on this
thankshi balu,
Am getting the error in running the jsp. the error is like
org.apache.jasper.JasperException: "{2}" Conversion Error setting value ''{0}'' for ''{1}''.
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
root cause
java.lang.IllegalArgumentException: "{2}" Conversion Error setting value ''{0}'' for ''{1}''.
com.sun.faces.util.Util.getSelectItems(Util.java:642)
com.sun.faces.renderkit.html_basic.SelectManyCheckboxListRenderer.encodeEnd(SelectManyCheckboxListRenderer.java:115)
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:712)
can u seggest me on this
can u give the example code for setters And getters of selecteditems, selectitems
thanks -
How to get substring from a string?
For example, there is a string:
C-REVF-00003 0010 Development
how the program get the value '0010'?Hi,
Use Split command.
Syntax
SPLIT <c> AT <del> INTO <c1>... <cn> INTO TABLE <itab>.
Searches the field <c> for the character <del> and places the partial fields before and after <del>
into the target fields <c1> <cn>, or into a new line of the internal table <itab>.
Ex.
DATA: STRING(60),
P1(20) VALUE '++++++++++++++++++++',
P2(20) VALUE '++++++++++++++++++++',
P3(20) VALUE '++++++++++++++++++++',
P4(20) VALUE '++++++++++++++++++++',
DEL(3) VALUE '***'.
STRING = ' Part 1 *** Part 2 *** Part 3 *** Part 4 *** Part 5'.
WRITE STRING.
SPLIT STRING AT DEL INTO P1 P2 P3 P4.
WRITE / P1.
WRITE / P2.
WRITE / P3.
WRITE / P4.
The output appears as follows:
Part 1 *** Part 2 *** Part 3 *** Part 4 *** Part 5
Part 1
Part 2
Part 3
Part 4 *** Part 5
Regards,
Bhaskar -
How to get structure from Idoc using function module?
Hi all,
I am looking for a function module in order to get the structure of a message type used for iDoc. The aim is to get the data element from the different fields in order to check authority if the data element is BUKRS.
Thanks for your help!
DavidHi David,
You can use the FM "IDOC_TYPE_COMPLETE_READ" which will get you the complete details of the IDOC type along with data elements referred for each fields in the segments.
The aim is to get the data element from the different fields in order to check authority if the data element is BUKRS.
Not sure if i understood the above requirement, if you could provide more info on the requirement, i guess you might get better a better solution from the forum. As there are other data elements with different names for company code (just look up *BUKRS* in SE11 under Data Elements to see what i mean), not sure if you can cover it all.
Regards,
Chen -
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");
-
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. -
How can i get getwayed url string using pluggable nav in news portlet?
hi.
How can i get getwayed url string using pluggable nav in news portlet?
A code just like below is what I want.
<param value="param=http://.../portal/server.pt/gateway/PTARGS_.../http/...">
I tryed the following, but didn't work as I wanted.
1.<param value="<pcs:valueexpr='var'/>">
-> transformed. but I want the prefix 'param=' in the enquoted string's too.
2. <param value="param=<pcs:valueexpr='var'/>">
-> not transformed.
Any idea?
HiroyukiHi all,
We have HPROF functionality in our latest roadmap, so you will see that feature in our next major release called JRockit R28.
I recommend, above from the MemLeak documentation suggested by Makiey, the following information on how to use JRockit tools.
Performance Tuning & Profiling:
http://download.oracle.com/docs/cd/E13150_01/jrockit_jvm/jrockit/geninfo/diagnos/part_02.html
Using JRockit tools:
http://download.oracle.com/docs/cd/E13150_01/jrockit_jvm/jrockit/geninfo/diagnos/part_03.html
Diagnostics & Troubleshooting
http://download.oracle.com/docs/cd/E13150_01/jrockit_jvm/jrockit/geninfo/diagnos/part_04.html
Best Regards,
Tuva
JRockit PM -
How to get data from a USB-UIRT device using Labview?
How to get data from a USB-UIRT device using Labview?
I'm trying to get data from a USB-UIRT device, is it posible with Labview?
I really appreciate your help,
thanksYou may want to contact the developer of the device for the API and DLL.
http://65.36.202.170/phpBB2/viewforum.php?f=3 -
How to get resultset from oracle procedure use ejb3
how to get resultset from oracle procedure use ejb3
i know oracle procedure should like this
Create or replace PROCEDURE resultset_test(
aaa IN NUMBER,
bbb OUT sys_refcursor) ....
but what s the ejb3 scripts looks like? please give me an example or link~
ths- there are no EJB3 scripts, only compiled application code
- the part of the EJB spec that deals with databases is called the Java Persistence API, but likely you are just looking for the JDBC API.
Now you should know what to Google to get your "example script": "java jdbc oracle procedure"
Maybe you are looking for
-
Hi everyone, I did all the necessary configuration for AR when im doing the post incoming payments the system showing an error AN ENTRY XX IS MISSING IN TABLE T043G Message no. F5100 can anyone help me Thanks... bagi....
-
Copy in mail file is too small to read easily. Cannot find solution.
In fact all copy on the monitor is too small...seemingly by default. Cannot find solution.
-
How can I extract RAR files right on my phone? I mean Series60, Series80
-
3ds Max importing to Final Cut Pro?
Is it possible to use a Windows 7 program through bootcamp such as 3ds max, and import a 3ds max composition into a mac program such as Final Cut for editing? For the msot part, I just want to be able to create something in Windows and export it into
-
Del hd of my 2nd macbook pro, how to fetch 10.7.4 again
del hd of my 2nd macbook pro, how to fetch 10.7.4 again, without paying