How to separate part of string using separator in java
Hi
I want to separate a part of a string having separator (/)
FirstName / MiddleName / LastName
Please help me
MayureshJoshi wrote:
Hi
I want to separate a part of a string having separator (/)
FirstName / MiddleName / LastName
Please help meString.split(...)
Similar Messages
-
How To Color a Text string using Regex (java.util.regex)
Hello,
How can I color a text string using regex class in 1.4?Yes, did you notice it said something about incredibly vague functionality?
Let me break it down for you
> How can I color a text string
Strings do not have color... You can color a component (a label, a button), but you can't color a string
> using regex class in 1.4?
Using a regular expression? How would a regular exression color anything? Do you have embedded color codes? Are you searhing a string for some secret word?
What are you talking about? -
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 can I pass a String by reference in java?
Hello!
My question is how to pass a String by reference in java.
I tried to declare my variable, instead of using "String xxx = "f";", I used "String xxx = new String ("f");" :
public static void main (String []args)
String xxx = new String("f");
StatusEnum result2 = getErrorPointStr(xxx);
public StatusEnum getErrorPointStr(String text)
StatusEnum testStatus = StatusEnum.PASS;
StringBuffer buffer = new StringBuffer();
buffer.append("123");
text = buffer.toString();
return testStatus;
After calling to getErrorPointStr(String text) function, xxx = "f"
So it does not work.
How can I solve this? It is very important, the function will receive String and not something else.
Thanks!Tolls wrote:
Which is why I said:
Which is why you only managed to change what 'text' referred to in the methodExcept that's not why. Even if String was mutable, doing text = whatever; would have the same effect; it would change what that variable refers to in the method, but it would not change the object's state.
I meant that, since there was no way to actually change the data (ie the char[] or whatever) within the object 'text' referred to, the OP was attempting to change what 'text' referred to and hoping it would be reflected outside the method...which we know won't happen as Java is pass-by-value.\Ah, now I see.
These by-value/by-reference threads tend to get confusing, because usually the person is passing a String, so the immutability of String tends to get in the way and just muddy the waters. -
How to create SQL Connections String using JSP
Hi, Dear I wrote sample Jsp program(Create a table and Inserted to Table) using SQLConnection
I got this Error, how to rectify please help me?
This is my Connection String
<%
String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
Class.forName(driver).newInstance();
Connection con=null;
ResultSet rst=null;
Statement stmt=null;
try
String url=java.sql.DriverManager.getConnection("jdbc:sqlserver://10.1.5.6:1433;Database=manickaraj;User=sa; Password=test*");
con=DriverManager.getConnection(url);
stmt=con.createStatement();
catch(Exception e)
System.out.println(e.getMessage());
if(request.getParameter("action") != null)
String CategoryName=request.getParameter("Category1");
String Description=request.getParameter("Description1");
String Status=request.getParameter("Status1");
stmt.executeUpdate("insert into Category(CategoryName,Description) values('"+CategoryName+"','"+Description+"','"+Status+"')");
rst=stmt.executeQuery("select * from Category");
%>
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 5 in the jsp file: /CategoryAction.jsp
Generated servlet error:
C:\Documents and Settings\manickaraj\.netbeans\5.5\apache-tomcat-5.5.17_base\work\Catalina\localhost\SampleJsp\org\apache\jsp\CategoryAction_jsp.java:61: incompatible types
found : java.sql.Connection
required: java.lang.String
An error occurred at line: 5 in the jsp file: /CategoryAction.jsp
Generated servlet error:
String url=java.sql.DriverManager.getConnection("jdbc:sqlserver://10.1.2.4:1433;Database=manickaraj;User=sa; Password=test*");
^
1 error
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)package shop;
import java.sql.*;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import javax.naming.InitialContext;
import javax.sql.DataSource;
public class DAClass {
private static Connection conn;
private static ResultSet rs;
private static PreparedStatement ps;
public static void connect(String dsn, String un, String pwd) {
try {
//access or Mysql odbc connectivity
//Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//conn=DriverManager.getConnection("jdbc:odbc:"+dsn,un,pwd);
//mysql
//Class.forName("com.mysql.jdbc.Driver");
//conn=DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/eshop?user=root&password=root");
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("jdbc/eshop");
conn = ds.getConnection();
//DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/MySQLDB")
catch(Exception e) {
//return "not soory";
public static boolean chkPwd(String un, String pwd) {
try {
boolean b=false;
ps=conn.prepareStatement("select * from cust_info where cust_name=? and cust_pwd=?");
ps.setString(1,un);
ps.setString(2,pwd);
rs=ps.executeQuery();
while(rs.next()) {
b=true;
return b;
catch(Exception e) {
return false;
}changed the code like this other part is same.implemented connection pooling but still its too lazy loding can you guide me? -
How can I split a document using separator sheets?
Hi there,
as I use s SnapScan-Scanner which is not capable to split a heap of scanned documents at any separator shett in-between I want to create a (apple)script that doese this. Has anybody an idea how to get to the goal?Adobe Reader can't split documents.
-
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 names of all used separations?
Hi there
How can I get the names of all used color-separations with javascipt?
CMYK and used spot-colors.
I want to place them into a textbox in illustrator (CS4) with a script.
Does anybody can help me??
thanks a millionList of inks can be obtained from Document.inkList and iterate through each ink to find whether InkInfo.printingStatus is set to "ENABLEINK"
here is the script
mydoc = app.activeDocument;
mydocTotalInkList = mydoc.inkList
mydocUsedInkList = new Array ();
j =0;
for (i=0;i<mydocTotalInkList.length;i++)
if(mydocTotalInkList[i].inkInfo.printingStatus=="InkPrintStatus.ENABLEINK")
mydocUsedInkList[j] = mydocTotalInkList[i].name;
j++; -
How to separate image from alpha using Quartz Composer?
Cross posting here and in the developers forums... (sorry for any duplication - also posting to the QC mail list)
I'm attempting to construct a Quartz Composer composition that will take an image containing transparency, and — within the structure of that composition — disect the image so that I can perform separate operations on the alpha mask and the full image (i.e. as if the mask did not exist). This would be akin to opening a PNG or TIFF in GraphicConverter, then accessing the images I want via Show Alpha Channel and Remove Alpha Channel.
I'm able to easily access the alpha channel by applying a Color Martix patch to the image, but I can't seem to figure out how to get to the full "unmasked" image.
Can anyone nudge me in the right direction as to how I could remove the alpha mask from an image?
Thanks!!
JohnHi John,
You could use the Core Image Filter to extract the Alpha channel as a mask, and then other filters to use that mask.
In the 'Settings' pane of 'Patch Inspector' for the 'Core Image Filter' place the following Core Image Kernel routine code:
A Core Image kernel routine
Alpha to Mask White Opaque, Black Transparent
kernel vec4 alphaToBlackWhite(sampler image)
vec4 pixelValue = sample(image, samplerCoord(image)); // Get a pixel
unpremultiply(pixelValue);
pixelValue.r = pixelValue.a; // Red channel
pixelValue.g = pixelValue.a; // Green channel
pixelValue.b = pixelValue.a; // Blue channel
pixelValue.a = 1.0; // Alpha Channel make Opaque
return premultiply(pixelValue);
Alternatively you could rewrite the above Kernel, more details on writing Core Image Kernels is in the developer documentation 'Image Tutorial: Writing Kernels'
Hope this helps,
Neil. -
How to extract a tagged string using XML in sql server 2014?
A column stores the string data with tag as below.I have to retrieve the value of ATRB_C1 as val1234 through xml
Query:
CREATE TABLE #test (col varchar(500))
INSERT INTO #test VALUES('< ATRB_C value ="val1" />< ATRB_C1 value ="val234" />')
SELECT * FROM #test FOR XML RAW
Output:
<row col="< ATRB_C value ="val1" />< ATRB_C1 value ="val234" />" />
Since the format is incorrect, not able to extract using xml.value
Any help would be appreciated!!CREATE TABLE #test (col xml)
INSERT INTO #test(col) VALUES('<ATRB_C value ="val1"/><ATRB_C1 value ="val234" />')
SELECT * FROM #test
Select Col1.value('(@value)[1]','varchar(20)') as [tab1_col1],col2.value('(@value)[1]','varchar(20)') as [tab2_col2]
from #test cross apply col.nodes('/ATRB_C') as tab1(col1)
cross apply col.nodes('/ATRB_C1') as tab2(col2)
drop table #test
Hope it Helps!! -
How to make comparison between strings using Labview
helo, i want to know, how to make comparison between array of string.?
the transmitter have send the assign text such as
A hello Bhye CbyeHi Syanitaa,
You actually only need to post the question once.
Multiple duplication. Please refer to this thread. -
How to pass a multivalue string parameter separated by comma in SSRS
i m using a parameter @paraBatchid which is a String (eg:test-3,test-4,test-5)
when i pass only one value it works fine .eg(test-3)
Now i have to use the values from Excel which will be copy pasted by the user concatenating the values with , and pasted in the textbox for batch Id.
i have used the join but it does not work for multivalue paramaters for some reason eg: Join(Parameters!paraBATCHID.Value,"','")
SELECT RT.INVENTBATCHID, RT.ITEMID, RT.DATAAREAID, RT.GROSSWT, RT.NETMETALWT, RT.NETSTONEWT, RT.NETACCESSORIESWT, RT.DATE,
RT.QTY AS BatchQty, II.FILEPATH, CASE ITS.ITEMTYPE WHEN 3 THEN 'Accessories' ELSE RLSUBT.ITEMSUBTYPE END AS ITEMSUBTYPE,
RLSUBT.QTY, RLSUBT.QTYPERBATCHQTY, RLSUBT.DUALQTY, RLSUBT.DUALQTYPERBATCHQTY, RLSUBT.UNITID, RLSUBT.DUALUNITID,
ITS.DATAAREAID AS Expr1
FROM ITEMIMAGES AS II RIGHT OUTER JOIN
REGISTRATIONTABLE AS RT INNER JOIN
REGISTRATIONLINESUBTYPE AS RLSUBT ON RT.INVENTBATCHID = RLSUBT.INVENTBATCHID AND
RT.DATAAREAID = RLSUBT.DATAAREAID RIGHT OUTER JOIN
ITEMTYPESETUP AS ITS ON RLSUBT.ITEMSUBTYPE = ITS.ITEMSUBTYPE ON II.ITEMID = RT.ITEMID AND II.MAINIMAGE = 1
WHERE (RT.DATAAREAID = @paradataareaid) AND (RT.INVENTBATCHID IN (@parabatchid)) AND (ITS.DATAAREAID = 'vri')
NOW
WHERE (RT.DATAAREAID = @paradataareaid) AND (RT.INVENTBATCHID IN ('test-3','test-4','test-5')) AND (ITS.DATAAREAID = 'vri')
the above Query Works fine in ..SQL but when these values is given to the parameter textbox in SSRS it does not work..Hai
When you are sending the multi value parameter to the SQL it will be sent as (‘Value1,Value2,Value3’) but not as (‘Value1’,’Value2’,’Value3’) there is the problem for it.
We have to do this using the dynamic query.
Here I am providing you the SQL qr=uery can you check it, whether it is the requried one.
Here is the Query:
DECLARE @Query NVARCHAR(4000)
SET @parabatchid = Char(39) + Replace(@parabatchid,',',Char(39)+','+Char(39)) + Char(39)
SET @Query = 'SELECT RT.INVENTBATCHID
, RT.ITEMID
, RT.DATAAREAID
, RT.GROSSWT
, RT.NETMETALWT
, RT.NETSTONEWT
, RT.NETACCESSORIESWT
, RT.DATE
, RT.QTY AS BatchQty
, II.FILEPATH
, CASE ITS.ITEMTYPE WHEN 3 THEN ''Accessories'' ELSE RLSUBT.ITEMSUBTYPE END AS ITEMSUBTYPE
, RLSUBT.QTY
, RLSUBT.QTYPERBATCHQTY
, RLSUBT.DUALQTY
, RLSUBT.DUALQTYPERBATCHQTY
, RLSUBT.UNITID
, RLSUBT.DUALUNITID
, ITS.DATAAREAID AS Expr1
FROM PWC_ITEMIMAGES AS II
RIGHT OUTER JOIN PWC_REGISTRATIONTABLE AS RT
INNER JOIN PWC_REGISTRATIONLINESUBTYPE AS RLSUBT
ON RT.INVENTBATCHID = RLSUBT.INVENTBATCHID
AND RT.DATAAREAID = RLSUBT.DATAAREAID
RIGHT OUTER JOIN PWC_ITEMTYPESETUP AS ITS
ON RLSUBT.ITEMSUBTYPE = ITS.ITEMSUBTYPE
ON II.ITEMID = RT.ITEMID AND II.MAINIMAGE = 1
WHERE (RT.DATAAREAID = ' + @paradataareaid + ')
AND (RT.INVENTBATCHID IN ( '+ @parabatchid + '))
AND (ITS.DATAAREAID = ''vri'')'
PRINT 'QUERY : ' + ISNULL(@Query,'NULL')
Exec (@Query) -
How to display complete filter string using maxl.
Hi,
I am trying to retrieve the strings for all the filters in an application which have read access enabled. Now, I have tried using MaxL command "Display Filter row". But, it only returns the first one or two members in the string but not the complete string. Please let me know if anyone finds a solution for the same.
TIA,
Vamsikrishna.you most likely need to use the Set Display Column Width in the MaxL statement. by default it is only 20 characters and my might need hundreds.
You might try set column_width 200; and see if it is wide enough -
How to Capture Multiple Line String using Regular Expression?
Hi,
I have a simple program like this:
What I want to accomplish is to capture everything between >>start and >>end using a single Match Regular Expression node. It seems that setting multiple? to True or False does not help.
I am using LabVIEW 2012.
If it is impossible to capture it using a single node, that is fine. But I want to make sure that I can make full use of this node without combining serveral others.
Thank you!
TailOfGon
Certified LabVIEW Architect 2013
Solved!
Go to Solution.Thank you for the fast response! Your solution worked in the example case
After I saw your post, I was finally able to step forward. But I still wanted to make use of dot notation due to the limitation of characters that match with \w.
I made some more modification to your regular expression then now it seems working for all characters:
>>start((?:\s|.)*)>>end
Thanks!
TailOfGon
Certified LabVIEW Architect 2013 -
How to check actual allocated and used memory for java process in solaris?
Hi,
I'm testing performance for java application on solaris 10. And I would like to know how to measure actual memory allocated and used for java process.
I'm setting -Xms512m -Xmx512m for my java process and I use prstat command to monitor it's memory. But I found that when I run prstat to check, in SIZE column is more than I setting (found 644).
So I'm don't know the actual memory that java process used. (In this case,is it mean the process use memory (644) more than setting (512)?)
Thank you.With Xms/Xmx you specify the Java heap size. On top of that comes the permanent generation (default max size 64m) and the C part of the process (the JVM itself with all its libraries and data).
With "ps -e -o pid,vsz,rss,args" you get the virtual and set resident size of your processes.
Nick.
Maybe you are looking for
-
the display goes to sleep after a few minutes and sometimes dosnt wake when i move the mouse or keyboard, i know its just the display becasue i can play music using the keyboard... i have to put my mac to sleep (CMDalteject) and then wake it for my d
-
Question for Herren Jung and Heilman re SE11 vs SE16n DDIC Buffers
In a dev logical system (XY1:nnn), I make a change to the domain and data element of a key field in a custom table. The change is immediately seen in SE11 in client mmm of system XY1 (the dev test client), i.e. when rows of the table are displayed, t
-
Click wheel doesnot work...
So basically I took apart my ipod video 30 gig(no warranty left on it anyways) because the centre button on the click wheel was stuck. I followed all precautions and put it back together properly. Next thing I know I turn on the iPod by clicking on t
-
Manually using itunes with 2nd computer
so i have my ipod all ready but when i want to put a song on it from my other computer, how do i do it? i've set it to manual so it doesnt delete the other stuff but how do i actually get the music on there? thanks
-
Hi! I need FREE servlet / jsp hosting. I searched the net, but I didn't found a provider that hosts ~10Mb of servlets, jsp and mysql database. I realy need it to earn money. Can anyone help me?? the provider has to give me access to a 10 Mb mysql dat