Find string from main string
Hi all
I have one location
E:\Testing\Test.xlxs
now I need only file name from this path.
what expression should I write to get this filename.
I need
Test only.
Kindly help
Thanks
Thanks for help
.Actually RIGHT( @[User::Path] ,FINDSTRING(REVERSE( @[User::Path] ),"\\",1)-1)
gives
test.xlsx
but i need test only wihtout extension.
SUBSTRING( RIGHT( @[User::Path] ,FINDSTRING(REVERSE( @[User::Path] ),"\\",1)-1) , 1 , FINDSTRING( RIGHT( @[User::Path] ,FINDSTRING(REVERSE( @[User::Path] ),"\\",1)-1), "." , 1) -1 )
Regards, RSingh
Similar Messages
-
Determine a string from main class in an outside class
Hello there,
This might be stupid question but I cant think, I am so very tired. Okay here is the question, is there any way we could see or the get the value of a string(just a string which is set in main class'A', its already set, we cannot make it static r anything like that)in a method outside that main class, probably in a method 'x' in class'C'.
Thanks
pottiYes, you can, in many ways, or else Java would be moot. Excluding the static way of doing it, which by the way is evil, your class C can make an instance of class A and then access it either as a public field or as the value returned by a public method. You can also use inheritance, but it's pointless in this case, inheritance is meant to abstract, extend functionality, and prevent having to rewrite code. It's not meant for accessing fields. And by the way, inheritance, too, is evil.
This is one way to do it.
class A {
public String s = "great balls of fire";
public class C {
public static void main(String[] args) {
A myInstance = new A();
String s = myInstance.s;
System.out.println(s);
}This is the preferred way to do it, as it encapsulates the String. The idea of encapsulation is to access fields by a method instead of directly since interfaces are less likely to change than an object's data and in the case that the object's data does change and the interface does not, the changes will remain local.
class A {
private String s = "great balls of fire";
public String getS() { return s; }
public class C {
public static void main(String[] args) {
A a = new A();
String s = a.getS();
System.out.println(s);
} -
Take and delete a String from another String
I have original input string= 111100001111
I need to Take for example the least 4 bits .... Output= 1111
and to be removed from the original input string so the original input string= 11110000
I am trying to make a generic one but the point is that I can not delete subset that I take from the original input String.
How can I take and delete from a string in the same time?
Solved!
Go to Solution.Something like this?
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Attachments:
Split String.png 13 KB -
Extracting the partial string from the string in oracle
Hello Friends,
I have a string like this
var str = '/G/CNH/CNHCornerstone/currentCode/data/Working/Images/ModelImages/png/7402203E-607D-E111-9CA5-005056875BD6.png'
I want to extract only 7402203E-607D-E111-9CA5-005056875BD6 from the string .
Please let me know how to implement this ..
thanks/kumar
Edited by: kumar73 on Apr 10, 2012 12:34 PMhope this works
set serveroutput on
declare
str1 varchar(4000);
str2 varchar(4000);
begin
str1 := '/G/CNH/CNHCornerstone/currentCode/data/Working/Images/ModelImages/png/7402203E-607D-E111-9CA5-005056875BD6.png';
dbms_output.put_line('string 1 : ' || str1);
str2 := substr(str1,71);
dbms_output.put_line('string 2 : '||str2);
end;
output
string 1 : /G/CNH/CNHCornerstone/currentCode/data/Working/Images/ModelImages/png/7402203E-607D-E111-9CA5-005056875BD6.png
string 2 : 7402203E-607D-E111-9CA5-005056875BD6.png
PL/SQL procedure successfully completed -
How to find number from text string??
Hi All,
Can you tell me how to find/ fetch number from string?
is there any function module for this.?
for example , I have string like "+++++1000000589+++"
and I need to fetch the invoice no 1000000589 from the above string..then How to do that? Letters may come first or number may come first and latter text...
Regards,
MrunalYou can do like this.
The below mentioned is code separate material
DO 18 TIMES.
LV_C = LV_C + 1.
LV_C1 = LV_C - 1.
IF GW_MATNR-MATNR+LV_C1(1) CN '0,1,2,3,4,5,6,7,8,9' .
IF ( ( LV_MAT EQ SPACE ) ) ." and ( lv_prefix eq space ) ) .
LV_PREFIX = 'X'.
CONCATENATE GW_TEMP-PREFIX GW_MATNR-MATNR+LV_C1(1) INTO
GW_TEMP-PREFIX.
ELSE.
LV_SUFFIX = 'X'.
CONCATENATE GW_TEMP-SUFFIX GW_MATNR-MATNR+LV_C1(1) INTO
GW_TEMP-SUFFIX.
ENDIF.
ELSEIF ( ( LV_SUFFIX EQ SPACE ) ) .
LV_MAT = 'X'.
CONCATENATE GW_TEMP-MATNR1 GW_MATNR-MATNR+LV_C1(1) INTO
GW_TEMP-MATNR1.
ELSEIF ( ( LV_MAT EQ 'X' ) ) .
CONCATENATE GW_TEMP-SUFFIX GW_MATNR-MATNR+LV_C1(1) INTO
GW_TEMP-SUFFIX.
ENDIF.
ENDDO. -
Checking for an element in a string from another string
Hi Guru's,
I have 2 comma seperated strings. Say like this.
a VARCHAR2(100) := '1,2,3,4,5,6,7,8,9,10';
b VARCHAR2(100) := '2,6,9';
My requirement is like I want to check the string a, whether it has any of the element in b. I am trying to use the regular expression. But I was not able to do it.
Kindly help me.
Regards,
VJSQL> var cur refcursor
SQL> declare
a varchar2 (100) := '1,2,3,4,5,6,7,8,9,10';
b varchar2 (100) := '2,6,9';
begin
open :cur for 'select column_value common
from table (sys.dbms_debug_vc2coll (' || a || ') multiset intersect sys.dbms_debug_vc2coll (' || b || '))';
end;
PL/SQL procedure successfully completed.
SQL> print
COMMON
2
6
9
3 rows selected. -
Extracting string from another string
Hi,
I have a problem that I am having difficulty solving, if anyone has any bright ideas it would be a great help.
I have a description field in one of my tables and the description would read something like
my website can be found at www.mywebsite.com, and it is great
I want to be able to extract the web address from this sentance, so the result would be
www.mywebsite.com
I can do this specific for one sentance but I can't find a way to do it for many different sentances.
cheers in advancer u expecting this..?
select substr('my web site is www.abcd.com and u can...',instr('my web site is www.abcd.com and u can...','www.',1),instr(substr('my web site is www.abcd.com and u can...',instr('my web site is www.abcd.com and u can...','www.',1)),' ',1)) from dual; -
Extracting a datetime string from a string multiple times
Hi,
I have a string like this:
1/9/2014 8:59:12 AM 7890565 666 1/10/2014 8:46:12 AM 6795007 546.........
I need to extract the datetime values that appear multiple times into a StringArray.
I found the following code that uses regular expression:
Matchm =
Regex.Match(inputString,@"\d{1,2}[-/\.]\d{1,2}[-/\.]\d{4}\s*\d{1,2}:\d\d(:\d\d)?");
It works fine but returns only the first datetime.
How can I enhancethe code to extract all the datetimes to a StringArray ?Use the
Regex.Matches
Method = all occurrences instead of
Regex.Match Method for only the first occurence.
Olaf Helper
[ Blog] [ Xing] [ MVP] -
Finding substring from string.
I'll have to find substring from another string. Substring to find can be example: CVB and the string can be example ACHGVNB.
Give me some hints about what methods I should use.Like this:public class Test {
public static void main (String[] parameters) {
String sub;
String text;
if (parameters.length == 2) {
sub = parameters[0];
text = parameters[1];
} else {
sub = "levi_h";
text = "l e v i _ h";
System.out.println (isSub (sub, text));
private static boolean isSub (String sub, String text) {
int s = 0;
int t = 0;
while ((s < sub.length ()) && (t < text.length ())) {
if (sub.charAt (s) == text.charAt (t)) {
s ++;
t ++;
return s == sub.length ();
}Kind regards,
Levi -
What happens when main(String[] args)
Hi techies,
I am trying to understand, "how the JVM invokes public static void main(String[] args)".
I had gone through JVM tutorial, and found that there are 2 different types of classloaders 1. bootstrap loader 2. user defined class loader.
I had gone through java api for class loader class. i did not find the method main(String[] args).
I am having confusion whether bootstrap loader calls main(String[] args)(or) userdefined classloader calles main(String[] args).
Why do we have to give String[] args as argument to main??
can you guys guide to understand this .
regards,
KrishnaHi techies,
I am trying to understand, "how the JVM
invokes public static void main(String[] args)".
I had gone through JVM tutorial, and
found that there are 2 different types of
classloaders 1. bootstrap loader 2. user defined
class loader.
I had gone through java api for class
loader class. i did not find the method
main(String[] args).
I am having confusion whether bootstrap
loader calls main(String[] args)(or) userdefined
classloader calles main(String[] args).
Why do we have to give String[] args as
argument to main??
can you guys guide to understand this
regards,
Krishnawell, you won't find main(String[] args) in the docs for ClassLoader, since it's not a method on ClassLoader!
the bootstrap loader loads, verifies, prepares and initializes the class for which you pass the fully.qualified.name into the JVM, and looks for the static method on that class called 'main' which has a single argument, an array of Strings, and no return type ( I'm not 100% sure of that last part actually - I'll try it ) and begins a thread of execution on that method. from there, your program is run
we have to give an array of Strings in order to pass arguments into the program
it can't be a user-defined classloader that does this, because most of the time there won't be a user-defined classloader! -
Grabbing each String from String[] ?
Hi guys,
how do i grab each String from a String[] and store it separately for later use? Ex i have a String[] {"Tom M F A D C A","SUE F M D D D D"};
Now i want to break it into tokens(im using StringTokenizer for that)
and store each value in some Collection ex Hashtable,Vector etc.
I cannot store it into a Collection? Please help...
thanks in advance,
SachinIs this what you had in mind?
Collection stringArraySplitter(String[] sa) {
Collection list= new ArrayList();
for (int i= 0; i < sa.length; ++i) {
StringTokenizer st= new StringTokenizer(sa[ i ]);
while (st.hasMoreTokens())
list.add(st.nextToken());
return list;
} kind regards -
Problem when calling session bean from main.
Hi everyone
I get the following error when calling a session bean from main(String args[]).
Sep 3, 2008 9:11:13 AM com.sun.enterprise.appclient.MainWithModuleSupport <init>
WARNING: ACC003: Application threw an exception.
java.lang.NullPointerException
at databasetest.Main.main(Main.java:26)
Here is my code beneath.
I'm using netbeans and glassfish application server.
Everything is in the same project, called DatabaseTest, I also have deployed the application before running the client.
I'm running the client as follows, right click on the DatabaseTest-app-client and select run.
The client:
package databasetest;
import com.test.UsersFacadeRemote;
import javax.ejb.EJB;
import com.test.Users;
public class Main {
@EJB
private static UsersFacadeRemote usersFacade;
public static void main(String[] args) {
Users users = new Users(12, 34);
usersFacade.create(users);
}The remote facade I'm calling:
package com.test;
import java.util.List;
import javax.ejb.Remote;
@Remote
public interface UsersFacadeRemote {
void create(Users users);
void edit(Users users);
void remove(Users users);
Users find(Object id);
List<Users> findAll();
}The stateless bean:
package com.test;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
@Stateless
public class UsersFacade implements UsersFacadeRemote {
@PersistenceContext
private EntityManager em;
public void create(Users users) {
em.persist(users);
public void edit(Users users) {
em.merge(users);
public void remove(Users users) {
em.remove(em.merge(users));
public Users find(Object id) {
return em.find(com.test.Users.class, id);
public List<Users> findAll() {
return em.createQuery("select object(o) from Users as o").getResultList();
}looks like you're banging your head against the same brick wall as [I have done|http://forums.sun.com/thread.jspa?forumID=13&threadID=5317110] and [others have in the past|http://forums.sun.com/thread.jspa?forumID=136&threadID=5259913] if that's any consolation.
Funny thing is, mine did actually work in the debugger but not when running!
Strange thing that.
I did initially interest someone from the developers but they couldn't really help, ended up saying : try instantiating your beans the EJB 2.1 way and see where that gets you. Yes that works but they promised us "hey no more dopey xml deployment descriptors just some cool annotations" didn't they?
I've got the feeling were' missing something really obvious!
Edited by: sebthebike on 03-Sep-2008 12:21 -
Can't find file when use the main(String[] args) method
I put a file under the DefaultDomain directory of Weblogic 11.1.1.5 on my local machine. Below is how I look up this file
FileInputStream fis = new FileInputStream("input.xml");
I started up the IntegratedWeblogicServer instance and I tested using the below 2 approaches.
1) When I test a web service program using the below approach, it CAN'T find the input.xml file
public static void main(String[] args)
2) When I package it into an EAR file and deploy it onto the server then log into the admin console and use the test client approach then it's able to find the file
How do I make it so it can find the file using #1 approach?
ThanksThat's how relative paths work, and it's nothing particular to Java.
When you type ls input.xml or dir input.xml does it list the file, or give an error? If it lists the file, then it's in your current directory, and it will work if you run Java from that directory. If it gives an error, then that file is not in your current working directory, and Java won't be able to find it either. -
How to look at a query string from Nav Bar Find Mode
I would like to view the resultant query string from the Navigavtion Bar's Find Mode. I am using a Master/Detail and am querying with the selection criteria from the detail only.
I am getting unexpected results, and would just like to SEE what the query string IS.
ThanksI am getting unexpected results, and would just like to SEE what the query string IS.Run your app with diagnostic output turned on. Here's the instructions for that.
To turn on diagnostic, go to the IDE,
1. Select the project.
2. Do right mouse click and select "Project Settings..."
3. On the Settings dialog, select Configurations/Runner.
4. In the righthand side pane, you should see a textbox for "Java
Options". Please add the following JVM switch:
-Djbo.debugoutput=console
Then, rerun. The run command should include
-Djbo.debugoutput=console as in
"D:\JDev9i\jdk\bin\javaw.exe" -Djbo.debugoutput=console -classpath ...
You should now see a lot more output on the IDE's message window.
This should also include the findmode query that gets built after you hit the execute button from a findmode panel. -
How to transfer a string from sub sequence to main sequence
Hi,
How to transfer a string from sub sequence to main sequence, My main sequence has included a sub sequence, the sub sequence is return a string value after running done, I need to get this string value from sub sequence to main sequence, I check the defined that look like seem the two
sequence have themself local variable,but I don't know how to defined a globe variable to cover main sequence and sub sequence like VC++'s Main App ,Please kindly help me,thanks in advance...Hi,
I hope this small example will help you.
Regards
Ray Farmer
Regards
Ray Farmer
Attachments:
Sequence File1.seq 36 KB
Maybe you are looking for
-
How can i receive message from one phone to the other
i have iphone 4s now i want to receive one text from the another phone
-
Please there must be somebody out there able to me!Ive got an Audigy2 SB0240 (driver: SBAX_WBUP2_LB_2_09_006.exe)? and Media Source (CMS_PCAPP_LB_3_30_2.exe) Windows XP Pro SP2So after the CORRECT Installation and?Updates to the actuall securely work
-
CRC missing file error when installing windows
When trying to instal windows on my Mac Pro desktop I keep getting the same error message. I must have tried it 6 times and always get the same message whether I am trying to my main disk partitioned, or to my secondary disk. It tells me to check my
-
Oracle Data Access Layer - w/Enterprise Services
I'm looking for an example Oracle Data Access layer incorporating Enterprise Services with at least a simple window form inserting and updating data tables. Can somepoint point me in the right direction? Thanks, Tony
-
Greetings all, I remember visiting the website of an artist in England. He used iWeb to create his site. He painted landscapes and made videos documenting his work. I believe he had some sort of personal project where he was going to paint out of doo