Removing last character of a string
Hi Gurus,
Is there any way to remove the last character of staring other that finding the string length and doing it?
waiting for reply
Ravi
HI,
yaa u can do this by one logic
wht u do is concatenate one special symbol like $ to the string wht u have and in the next statement by using tht special symbol u can find fdpos i.e. field postion i.e. at which lenght it is there and then in again another statement u can increa fdpos by one and u can cut the string at tht length
i think u got my logic
further if u have any quiries u can contact me on [email protected]
plzz reward if it is usefull....
Similar Messages
-
Truncating last character in a string
I am making a dialpad. It is just for display so I am using a
string for the numbers selected. I am trying to make a back button
that would clear the last number added. I tried mystring.length-1
but that doesn't seem to be doing the trick. Is there a simple way
to truncate the last character in a string, of variable
length??Here's an example
var someStr="asdfasdf saf asdf sadfas dfs fsa asf";
while (someStr.length) {
someStr = someStr.substring(0,someStr.length-1)
trace(someStr);
} -
How to delete last character in a string
Guys i have a question...
how can i delete the last character in a string..
for example
String myString = "helloWorld, ";
how do i delete the last character in this string which is a "," ?String newString = myString.substring(0, myString.length()-1);
-
How we can find the last character in a string(Urgent Plz!)
Gurus!
How we can find the last character in a string.
e.g i have a string say "Str" with value "10-01".
Now i want to find the last character in "Str" i.e "ONE=1".
i am using Oracle developer 6i with Oracle 8i(1.7).
Plz help!
Many thanks!Use the substr() and length() functions -
x := '10-01';
y := substr(x, length(x)); -
Testing the last character of a string using .endsWith
Hi,
I want to check to see if the last character of a string is '@'.
I tried if (StringAt.endsWith("a")) {
but got no results.
Is this the correct way to do it or is there another way.
Thanks.
Adamjavadocs:
String's endsWith method takes a string argument.
endsWith
public boolean endsWith(String suffix)
Tests if this string ends with the specified suffix.
Parameters:
suffix - the suffix.
Returns:
true if the character sequence represented by the argument is a suffix of the character sequence
represented by this object; false otherwise. Note that the result will be true if the argument is the
empty string or is equal to this String object as determined by the equals(Object) method.
Throws:
NullPointerException - if suffix is null. -
Hi Gurus,
I want to get the last character of a String.For Ex.
I have name = 'ZXCDFG":?'
And I want to print the last character ?.
How can i do it.
Thanks in Advance.Hi Pradeep,
Just find the String Length and use the offset commands
DATA : DATA TYPE CHAR20 'ABCDEFG',
DATA : DATA1,
DATA : LEN TYPE I.
LEN = STRLEN( DATA ).
LEN = LEN - 1.
DATA1 = DATA+LEN(1).
Regards
Kumar M. -
Deleting last character of a string
Hi Abapers,
I want to delete the last character of my workarea and then store into table.
The workarea says that it is FAX|
I have to remove the last character.
How to do tht.
Please reply.
Thankshi
do this in following way
frist find the String length
let it will be
w_str = 'sdn is wonderfull'
now use.
w_len = strlen(w_str) .
now
w_result = w_str+0(w_len - 1).
Cheers
Snehi -
How to remove last char in a string by space
I have to implement backspace application(remove a last char in a string , when we pressed a button).
for ex: I enter the no
1234
instead of 1236
So when i press a button on the JWindow... it should display
123
so that i can enter 6 now.
I tried to display the string "123 " instead over "1234" but it is not working when the no background is specified. but works fine when a background color is specified.
The string is displayed as
Graphics2D g = (Graphics2D)window.getGraphics();
AttributedString as = new AttributedString(string, map);
g.drawString(as.getIterator(),x,y);
In the map, the background is set to NO_BACKGROUND.
Thanks and regardsDeja vu. I saw this kind of post before, and I'm sure
it was today.http://forum.java.sun.com/thread.jspa?threadID=588110&tstart=0
Here it is. -
To delete first and last character of a string???
Hi Everybody !!!
Do you know a method that can permit to delete in a string the first and the last character?
For instance I have in my string this word : [the word]
I would like to delete the '[' and the ']' character.
Is exist a method that permit to delete this character?
Thanks !!!Look at the substring method of the String class.
Note that since string is immutable, you'll need to assign the results of substring to a variable (could be the same as the original or different). -
How to remove certain character from a string?
Follows the table:
CT_TRABALH
400rj101
400rj102
400rj103
400rj104
400rj105
400rj106
400rj107
400rj108
400rj109
400rj1010
400rj1011
I woulld like to make the following with its values. For example the value 400rj1010
I would like to remove its last character (400rj101) and then relace the last zero for the last number(400rj111) by query. Is there any way I can achieve this?I would write something a little more generic :
SCOTT@demo102> with tbl as
2 (select '400rj101' as CT_TRABALH from dual union all
3 select '400rj102' from dual union all
4 select '400rj103' from dual union all
5 select '400rj104' from dual union all
6 select '400rj105' from dual union all
7 select '400rj106' from dual union all
8 select '400rj107' from dual union all
9 select '400rj108' from dual union all
10 select '400rj109' from dual union all
11 select '400rj1010' from dual union all
12 select '400rj10120' from dual union all
13 select '400rj14120' from dual union all
14 select '412rj14120' from dual union all
15 select '400rj1011' from dual )
16 select CT_TRABALH,
17 case when substr(CT_TRABALH,-1,1) = '0'
18 then decode(instr(substr(CT_TRABALH,1,length(CT_TRABALH)-1),0,-1),
19 0, substr(CT_TRABALH,1,length(CT_TRABALH)-1),
20 substr(CT_TRABALH,1,instr(substr(CT_TRABALH,1,length(CT_TRABALH)-1),0,-1)-1)
21 ||substr(CT_TRABALH,-2,1)
22 ||substr(CT_TRABALH,instr(substr(CT_TRABALH,1,length(CT_TRABALH)-1),0,-1)+1,
23 length(CT_TRABALH)-instr(substr(CT_TRABALH,1,length(CT_TRABALH)-1),0,-1)-1))
24 else CT_TRABALH
25 end as CT_TRABALH_0
26 from tbl;
CT_TRABALH CT_TRABALH_0
400rj101 400rj101
400rj102 400rj102
400rj103 400rj103
400rj104 400rj104
400rj105 400rj105
400rj106 400rj106
400rj107 400rj107
400rj108 400rj108
400rj109 400rj109
400rj1010 400rj111
400rj10120 400rj1212
400rj14120 402rj1412
412rj14120 412rj1412
400rj1011 400rj1011
14 rows selected.
SCOTT@demo102> Nicolas. -
Want to single out the last character of a string
There is a field where there are many strings of varying length. E.g.: AB001XUV, AB003XUK, DJ8933FXUV etc.
From these strings I need to create a virtual column where only the last character is shown. So it shall be V, K, V for values from the above example.
Can anyone please suggest me how to achieve this.
Regards
HawkerSQL> with t as (
2 select 'AB001XUV' col from dual
3 union
4 select 'AB003XUK' col from dual
5 union
6 select 'DJ8933FXUV' col from dual
7 )
8 select substr(col,-1,1) from t
9 /
S
V
K
V
SQL> create table temp(id number,
col varchar2(10),
VIRTUAL_COL VARCHAR2(1) GENERATED ALWAYS AS (substr(col,-1,1)) VIRTUAL
SQL> insert into temp(id,col) values(1, 'AB001XUV') ;
SQL> select * from temp ;
ID COL V
1 AB001XUV V
SQL> Edited by: Azhar Husain on Aug 16, 2011 1:17 PM -
Select last character of a string
Hello,
I would like to select the last character of an address string. For example, in '165 John Ave W' -- select result 'W'. I tried to use RIGHT but it doesn't work. I'm using SQL Plus.
SELECT RIGHT(ADDRESS,1) FROM addresses;
ORA-00904: "RIGHT": invalid identifier
I can't find the appropriate select statement to achieve the result I want. Ideas?
Thanks!The SUBSTR function can take a negative start parameter, which counts in from the end of the string
http://www.techonthenet.com/oracle/functions/substr.php - that should get you going, let me know if you get stuck.
Carl -
The last character of a string
How to judge the last char of a string is " ?
if (s.endsWith("""))or
if (s.endsWith("/""))bet
you just copied and pasted what the OP had written
and quickly put that
backslash in, hit post without previewing first just
to make me look like
a slow old sod! It's not fair ;-)
kind regards,
JosNope, I used the Alt-[numeric code] combinations to manually type each character. Cut-n-paste is for wimps, and actually typing single-stroke keys is for milquetoasts.
Alt-[numeric code] is for real men ;-) -
To remove last '/' character
I need to remove '/' character and string comes after it. I will give an example.
CREATE TABLE TAB (COL1 VARCHAR2(50));
INSERT INTO TAB VALUES ('hIA/SS/TTTT/FFFF');
INSERT INTO TAB VALUES ('hDFF/AA/S/AAAAAAAA');
I should remove the last '/' and string comes after it so when i query , i should get result as
hiA/SS/TTTT
hDFF/AA/S
Please help meHi,
Welcome to the forum!
Here's one way:
SELECT col1 -- if wanted
, REGEXP_REPLACE ( col1
, '/[^/]*$'
) AS up_to_last_slash
FROM tab
;Regular expressions can be very convenient, but they can also be slow. If performance is a problem, try this instead:
SELECT col1 -- If wanted
, NVL ( SUBSTR ( col1
, 1
, INSTR (col1, '/', -1) - 1
, col1
) AS up_to_last_slash
FROM tab
;This is basically what Chris posted earlier, except that it returns col1 unchanged when col1 does not contain a '/'.
Thanks for posting the CREATE TABLE and INSERT statements; that's very helpful!
Edited by: Frank Kulash on Oct 8, 2012 7:32 AM -
Removing last 2 characters from string field
I am trying to remove the last 2 characters of a string field.
there is no consistant length in the field
316R1
12364R1
i want to remove everything after R
i tried instrrev but i that didnt do it.
is there a way to say
start position1 and go the R
thanksformula,
left (field, length_formula) is the solution
the length_formula is the number of chars form left
f.i
left(field, length (field)-2)
left (field, InstrRev, field,"R")
of course a combination with Right is also possible
Maybe you are looking for
-
Logical standby stopped when trying to create partitions on primary(Urgent
RDBMS Version: 10.2.0.3 Operating System and Version: Solaris 5.9 Error Number (if applicable): ORA-1119 Product (i.e. SQL*Loader, Import, etc.): Data Guard on RAC Product Version: 10.2.0.3 logical standby stopped when trying to create partitions on
-
Same Image every time in JTextField with HTMLEditorKit and HTMLDocument
Hi all I have a JTextPane with HTMLEditorKit as editorkit and HTMLDocument as document. I am trying to load an html file into the text pane. the html file contains image. When loading first time it is shown perfectly. After I change the image file wi
-
Change name of a workset?
I am trying to change the names (not IDs) of some worksets in our ESS/MSS, since we got a product called Siteminder installed and we cannot put any iviews/pages/worksets in edit mode if it has special characters (like ' or < >, etc) in the name. So I
-
APPCRASH windows 7 (64bit) itunes 10
Hi there, i have a Iphone 3gs i havent updated the software till now and now i have put the latest phone and Itunes software on my computer and now i cant sync my phone before a window appears showing: Problem signature: Problem Event Name: APPCRASH
-
Connecting 3 wireless bridges together on different networks.
here is problem. I have dsl internet access (gateway 209.152.93.126) coming into the house to the modem. from there it goes to a wrt56g (192.168.2.1) which runs to 1 computer, a tv and a wap54g (in bridge mode). This bridge points to another wap54g