Contain string
Hello all,
Can any tell me how i will find perticular word in a string.
e.g.. s = 'Rajesh Kumar Choudhary'.
if in this string 'Rajesh' is present then i want give message 'string found'.
please read sentence carefully.
Rajesh.
hi,
try this code.
DATA: S TYPE STRING.
PARAMETERS: P(20) TYPE C.
S = 'Rajesh Kumar Choudhary'.
case p.
when 'Rajesh'.
perform f_str_chk using p.
when 'Kumar'.
perform f_str_chk using p.
when 'Choudhary'.
perform f_str_chk using p.
when others.
write 'Invalid String'.
endcase.
form f_str_chk using l_str(20) TYPE C
if s CS l_str.
write : 'String found'.
else.
write : 'String Not found'.
endif.
end form.
Rgds
Anver
Similar Messages
-
Treeset.contains(String) is case sensitive ?
hi
i noticed that treeset.contains(String) is case sensitive.
when you all are testing keywords do you therefore put everything to lower case to test ?
just double checking something extremely simpleWell strings are case sensitive. Try using String.equalsIgnoreCase(String) to compare strings without regards to case. As for using it in collections, you may want to convert all strings to upper or lower case before placing them into collections (this may not always be possible due to "business reasons").
Note: contains(String) on the Collection interface uses Object.equals(Object o) to test object equality. The implentation of equals on String will return true if and only if the argument is not null and is a String object that represents the same sequence of characters as this object. Case will not be ignored in this implementation.
Hope this helps. -
How do Import a csv file that contains strings
I have a file that contains numbers as US formmated $$$ such as $1,123,123,123 I have a perl script on one of our linux servers that creates the csv file as
"Total Dollars","$1,123,123,123","some other string","etc" but when I import the file into numbers
Unnamed Table
Average Price'
$160
686'
$222
482'
$114
820'
$188
062'
I cant find a setting anywhere that says to ignore commas inside a string. This works in most other applications.I apologize but you wrote :
WALTER-MILANO-ITALY wrote:
You should be now able to import the file using ; as separator or if you prefer you can do again the change of ; with ,
It's not a matter of preferences. The OP can't import a file whose values are separated by semi-colons.
He must replace them by commas.
With your scheme :
Original datas
'Total Dollars','$1,123,123,123','some other string','etc'
after your step 1
'Total Dollars';'$1,123,123,123','some other string','etc'
after your step 2
'Total Dollars';'$1,123,123,123''some other string''etc'
and the datas are completly unusable
A possible scheme would be :
Original datas
'Total Dollars','$1,123,123,123','some other string','etc'
'Totals Dollars','$12,123,123,123’,’blahblah’,’etc'
after possible step 1 (replace ‘,’ by ",")
'Total Dollars";"$1,123,123,123";"some other string";"etc'
'Totals Dollars";"$12,123,123,123";"blahblah";"etc'
after possible step 2 (replace single ‘ by ")
"Total Dollars";"$1,123,123,123";"some other string";"etc"
"Totals Dollars";"$12,123,123,123";"blahblah";"etc"
after possible step 3 (replace ";" by ",")
"Total Dollars","$1,123,123,123","some other string","etc"
"Totals Dollars","$12,123,123,123","blahblah","etc"
This one may be imported by Numbers on thez OP’s machine.
I don't know if these changes may be done with Perl but I know that they are easy to do with AppleScript.
But honestly, if Perl is able to build a TAB separated values file, it would be more efficient.
Yvan KOENIG (VALLAURIS, France) mercredi 25 janvier 2012
iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
My Box account is : http://www.box.com/s/00qnssoyeq2xvc22ra4k -
Contains (String function) is not working in switch condition .
Hi All ,
I have a interface in which there are two projects.
1 notification interface
2 DFW interface .
Project 1 Has Mediator in it where I am checking a Filter condition on DESTINATION PARTNER ID as below
contains($in.request/inp1:TSOHoldCommon/inp1:Destination_Partner_ID,'DFW')
as you all know this is the string function(containd) I have used.
But there is a problem I am facing , when i use the same condition in DFW INTERFACE in all the switch conditions i have used .
So now the problem is in switch condition used in BPEL of DFW INTERFACE.
I have a asign statement after this condition,and i am getting assign pending so flow is faulting.
please help me in this regard or give me any suggestions for fixing this .
BPEL VERSION 1.1
SOA 11.1.1.6Please post the error log which you are getting in EM.
Thanks,
Ashutosh -
Breadcrumbs containing string with spaces - generating the anchor
so I have a website that contains a 'breadcrumbs' line that allows users to click on it, and take them back to the parent page
eg. "jewellery"
I simply suffix this string with ".cfm" to generate the anchor / filename
what's the best way to deal with strings containing spaces?
eg. "birthday cards"
As good practice I want to use a more compatiable filename that doesn't include spaces
eg. "birthday_cards.cfm"
is the REPLACE command ok to use ? or is preferrable to add an additonal field to the table, called "filename" and store the exact filename in there ?option 1
use quotes like href="http:\\....."
option 2
convert spaces to %2B -
Sorting of Vector which contains String
Hi,
I have the following code which contains a vector. The vector has String elements. Now I want to know how to sort the elements in the Vector. I know that there is Collections.sort(). But I want to sort the elements needless it is uppercase or lowercase. The Collections Sort method will sort all uppercase strings first and then sort the lowercase ones. Here is the code which I`m doing: -
Vector v = new Vector();
v.add("three");
v.add("one");
v.add("two");
v.add("ABC");
v.add("abc");
v.add("AA2");
v.add("ZXY");
v.add("SuPer");
v.add("4XDR");
Collections.sort(v);
System.out.println(v);I want to get the output something like this:
4XDR, AA2, ABC, abc,one,SuPer,three , two, ZXYwrite a comparator and implement the compateTo method for your objects, so you get the output you need by calling
Collections.sort(List<T> list, Comparator<? super T> c) -
Finding All Methods Containing String
Hi All, I have a problem that I was hoping someone has already solved. Basically I need to generate a list of all the methods(and the classes they are in) that contain a given String. Has anyone got any ideas for me ?
Thanks,
Al.Do you mean that the code inside the method contains a particular sequence of characters? Or that the name of the method contains a particular sequence of characters? If you are developing on Windows, then Windows Explorer has search capability that includes "files containing ...", so you could at least identify the classes.
-
String contains string boolean
Hi.
I am reading lines from a file. On a line there could be "blauw" for
example. I tried if(file.readLine == "bluaw"){} but it doesn't seem to work, maybe because there is a hard return in the readLine string? So I'm wondering how I can test if the readLine string CONTAINS "blauw"...
Thanks!String line = file.readLine();
if (line == null) {
// end of file.
else if (line.indexOf("bluaw") != 1) {
// line contains "blueaw"
} -
Adjust swing component size to the containing string
Hi,
I'm facing a problem with an application I am internationalizing. This application had all interface items with English strings but now it needs to display different languages. I'm doing this using ResourceBundles and properties files with the translated strings.
My problem is that while some strings fit nicely in the widget, others don't. For example, I have a button that displays "Run" in the English version and "Ejecutar" in the Spanish version. This doesn't happen, all I see is "Ejec..." .
Is there some way to tell a widget (JButton, JTextField, etc.) to adjust to the String's width?
Thanks in advance,
Lucas VieitesI'd recommend to adjust the size of the dialog in accordance with the length of the messages.
This resize issue can happen even with the default language in case user change system font size. -
Contains String (CS) in SAP Scripts
Hi Friends,
I have a requirement which we need to check ABAP statement CS is not working in SAP scripts is there any other way to use this ?
The requirement is like as below:
For Example:
&VBDKA-SLAND& is having the value of 'INDIA'.
/: IF &VBDKA-SLAND& CS 'DI'.
AS INDIAN
/: Endif.
Regards,
Dwaraka.Hi,
You can try something like this.
In your program write
IF &VBDKA-SLAND& CS 'DI'.
flag = 1.
ENDIF.
Now in script
/: IF flag = 1.
AS INDIAN
/: Endif.
Thanks,
Sri. -
Public static boolean contains(string s, string t)
i am just a beginner to java....plz help me out...this is my first time programming.
Is it possibly also your first time posting a question on a technical forum?
Try asking a question. -
Hi,
I just need a simple way of doing this as at the moment, i read one line at the time containing strings and numbers, whenever i convert this line to an array i loose the strings, if i want to display it, it displays as a group of lines while i would like to display it as a table with column headers. The file is an .xls worksheet.
Any suggestions?
Thanks
MeHi,
Look at attach vi.
If this is not what you need please clarify.
With ActiveX you can Open Excel, interact with it (read and write values to cells...
But if you can read it this way, I think it's easier.
Hope this helps,
Paulo
Attachments:
XL.zip 24 KB -
How to find string contain.
Dear all,
i want to find some char from a given string like below example
vtext = PM-BGM12_AC :
if vtext contain '_AC' then i have to assinge btext = ' Air Conditioner'.
if vtext = PM-BGM12_BPI contain '_BPI',
then i have to assign btext = ' Building & Permanent Improvement '
i m consfuse what to user ca , co, cs, cp.
*********point is assured *********hi,
chk out this
<b><b>CO</b></b> Contains Only: True, if operand1 only contains characters from operand2. Upper/lower case and trailing blanks are taken into account for both operands. If operand2 is of type string and is initial, then the logical expression is false, unless operand1 is also of type string and is initial, in which case the logical expression is always true. If the result of the comparison is negative, sy-fdpos contains the offset of the first character in operand1, that is not contained in operand2. If the result of the comparison is positive, sy-fdpos contains the length of operand1.
<b>CN</b> Contains Not Only; True if a logical expression with CO is false, that is, if operand1 contains not only characters from operand2. sy-fdpos is set in the same way as for CO. If the comparison is true, sy-fdpos contains the offset of the first character in operand1 that is not contained in operand2. If the comparison is false, sy-fdpos contains the length of operand1.
CA Contains Any: True, if operand1 contains at least one character from operand2. Upper/lower case and trailing blanks are taken into account for both operands. If operand1 or operand2 is of type string and initial, the logical expression is always false. If result of the comparison is positive, sy-fdpos contains the offset of the first character in operand1 that is also contained in operand2. If the result of the comparison is negative, sy-fdpos contains the length of operand1.
<b>NA</b> Contains Not Any: True if a logical expression with CA is false, that is if operand1 does not contain any characters from operand2. If the result of the comparison is negative, sy-fdpos contains the offset of the first character in operand1 that is also contained in operand2. If the result of the comparison is true, sy-fdpos contains the le of operand1.
CS Contains String: True if the content of operand2 is contained in operand1. Upper/lower case is not taken into account, trailing blanks of the left operand are taken into account. If operand1 is of type string and initial, or of type c and contains only blank characters, the logical expression is false, unless operand2 is also of type string and initial, or of type c and only contains blank characters. In this case the logical expression is always true. If the result of the comparison is true, sy-fdpos contains the offset of operand2 in operand1. If the result of the comparison is negative, sy-fdpos contains the length of operand1.
<b>NS</b> Contains No String: True, if a logical expression with CS is false, that is if operand1 does not contain the content of operand2. If the result of the comparison is negative, sy-fdpos contains the offset of operand2. If the comparison is true, sy-fdpos contains the length of operand1.
<b>CP</b> Covers Pattern: True, if the content of operand1 fits the pattern in operand2. Wildcard characters can be used for forming the operand2 pattern, where "" represents any character string, and "+" represents any character. Upper/lower case is not taken into account. If the comparison is true, sy-fdpos contains the offset of operand2 in operand1, whereby leading wildcard characters "" in operand2 are ignored if operand2 also contains other characters. If the comparison is false, sy-fdpos contains the length of operand1. You can select characters in operand2 for a direct comparison by adding the escape symbol "#" before the required characters. For these characters, upper/lower case is taken into account, wildcard characters and the escape symbol itself do not receive special treatment, and trailing blanks in operands of type c are not cut off.
<b>NP</b> No Pattern: True, if a logical expression with CP is false, that is, if operand1 does not fit the pattern operand2. If the comparison is false, sy-fdpos contains the offset of operand2 in operand1, whereby leading wildcard characters "*" in operand2 are ignored if operand2 also contains other characters. If the comparison is true, sy-fdpos contains the length of operand1.
thanks
jaideep
*reaward points if useful.. -
Split string contained in a column into 4 columns
SQL 2008 R2
Hy guys,
A column contains string such as A/B/C/D
I would like to split the string in four (4) columns
Col1 Col2 Col3 Col4
A B C D
Many thanksTry this
CREATE FUNCTION [dbo].[SplitString]
(@instring VARCHAR(MAX))
RETURNS @Splitstring TABLE(Columnslist
VARCHAR(MAX))
AS
BEGIN
DECLARE
@len
INT,
@i
INT=1,
@N
INT=1,
@instring
VARCHAR(MAX),
@instrings
VARCHAR(MAX)= @input +
SET @len = LEN(@instrings)
WHILE @i<=@len
BEGIN
IF
SUBSTRING(@instrings,@i,1)='/'
BEGIN
SET @instring = SUBSTRING(@instrings,@N,@i-@N)
INSERT INTO @SplitString(Columnslist)
SELECT @instring
SET @N = @i+1;
END
SET
@i = @i+1;
END
RETURN ;
END
GO
Andy Tauber
Data Architect
The Vancouver Clinic
Website | LinkedIn -
BigDecimal.ZERO and String.contains()
I have a weird problem. I have a program that uses both of the subject items. I ran into an subversion issue, so I deleted my src folder, then downloading everything from the repo again. After downloading, "BigDecimal.ZERO cannot be resolved" and "The method contains(String) is undefined for the type String". All of this worked before the wipe. Anyone know what's going on?
MikeThey were both introduced in JDK 1.5. Apparently you're using the wrong JDK version.
Maybe you are looking for
-
How to print double sided with macbook pro on Samsung CLX-3180?
Hi, I recently switched to using a macbook pro but cannot figure out how to print double sided/two-sided. The printer I am using is Samsung CLX-3180 and it allows double-sided printing. I was able to do this with my windows computer previously. The f
-
Private Sub LoadGRN() Dim ddlGRN As SAPbouiCOM.ComboBox Dim objRecord As SAPbobsCOM.Recordset Dim intI As Integer Dim intValue As Integer Try ddlGRN = SBO_Application.Forms.ActiveForm.Items.Item("dd
-
Hi Experts, Please give the code or documentation to develop the <b>KM Repository Manager</b> in NWDS. Regards, Venkatesh.K. Points will be awarded.
-
Start Workflow AFTER File Is Uploaded
I want workflow to start AFTER i copy file through webdav (drag n drop). Now it starts workflow BEFORE file is uploaded. Workflow uses data from the file so the order is crucial. Is it possible?
-
Photoshop Elements 4 failed installation.
I tried to install Photoshop Elements 4 on my new Mac but the installation failed. Help!