Check String contains a word or not?
Hi Friends,
I have a string which is containing list of words. I have to check the string contains perticular word in it or not.
e.g. String str = "I am Hiren Modi";
In java, Is there any function which can help me to find Hiren world is there in str variable or not?
Thanks in advance...
- Hiren Modi
venu_gopal wrote:
hi,
myself is venu. i hope that there is no method. explicitly we have to write the logic for that.
bye..Venu , please go through string API there is contains() method u can use , instate of writing u r own logic
read it http://java.sun.com/javase/6/docs/api/java/lang/String.html
Edited by: AmitChalwade123456 on Nov 20, 2007 5:27 AM
Similar Messages
-
Best way to split a single string containing 2 words into word1 and word2
Whats the best way to take a string containing 2 words and split it into 2 strings ?
eg. "red ferrari"
string1 "red"
string2 "ferrari"If your list is always going to have exactly two words, then yes. Otherwise it depends on your requierments.
-
Need reg_exp for checking the string contains only alphanumeric or not
Dear All,
I need to check the given string in if condtion contains only the alphanumeric or not pls help me..
like
if reg_exp then
end if;
thanks,
OracleHi,
REGEXP_LIKE ( str
, '[^[:alnum:]]'
)returns TRUE if the string str contains any character other than an alphanumeric.
You can use this wherever conditions are allowed, such as a WHERE clause or a CASE expression. For example:
SELECT str
. CASE
WHEN REGEXP_LIKE ( str
, '[^[:alnum:]]'
THEN 'Contains speace, punctuation or special symbol'
ELSE 'Okay'
END AS is_alnum
FROM table_x
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say what version of Oracle you're using.
Edited by: Frank Kulash on Dec 30, 2011 4:37 AM -
Publish Handouts in Word 2007 not working
Our office recently upgraded to Word 2007 and now I am unable
to publish Word handouts in Captivate. I have tried both Captivate
2 and 3, and neither work. I get the following message:
An error was encountered while publishing to Word. Please check
and make sure Word is not busy and try again.
Anyone ever seen this before? Word is not currently running,
no documents open, etc.
Thanks,
Erin
Instructional Systems Engineer
Excelsior CollegeHi Erin,
I just ran into this same issue. I found a fix on the following Microsoft site:
http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.off iceupdate&tid=d2bb191a-1c07-4c15-99bd-e1276ff88798&cat=&lang=&cr=&sloc=&p=1
Basically it said to remove the converter from the registry, and Word 2007 would use it's own converters.
Hope you find this helpful! -
Find Whether String Contain Sequence Of Character Or Not
<b>
hello friend,
I am to the new java. I need to findout whether the string contain sequence of character or not. I tried like this
personLastName.length()> 0
It will return true even my string contains space. Is there any other method in java to find out ?
ThanksThere are a few ways to do that. Check out the String class or Regex for one that suits but
myString.indexOf(whatIWantToFindString)is an old favorite. It returns -1 if the sequence is not there, or the starting index if it is. The javadocs are your friends.
regards -
Check if a string contains another string
can anybody help?
String st="DC";
how can i check if another string contains "DC" or not?How bout
if(someString.indexOf(st) != -1) {
//someString contains st at some point
} -
I have a table named Documents that has Content field full text indexed
Now i need to create a query in such a way that the query should return docs that have at least one word "hello" that does not have word "world" following it.
--sth like
select content from documents
where contains(Content,N'hello(not followed by word "world")')
And the result should be
"hello" -- since this does not have world following hello in it"
"hello friend and hello world" -- this document has word hello that is not followed by world it it"
Can a full text query be formulated in a way to achieve above results? If so how?? I want to avoid parsing Content manually as much possible as I can.Hi Mokchhya,
According to your description, the issue regards SQL Server Search, I will help you move the question on the related forums, and It is appropriate and more experts will assist you.
In addition, I do a test. If you want to get the results which contains ‘hello’ characters and not contains’ world’ characters. I recommend you use NOT on any boolean expression. For example, if you create full test catalog and full test index. When you
need to find the document records who has “hello” in their content, and does not have “ world” in content, CONTAINS( ) is takes one keyword to match with the records.
select * from <database>.<schema>.<table>
where contains (Name, 'hello') and not contains (Name, 'world')
For more information, see:
http://blog.sqlauthority.com/2008/09/05/sql-server-creating-full-text-catalog-and-index/
if you don’t use full text search, you can use Like with wildcarding to scan a column. For example,
;With cte As
(select * from <database>.<schema>.<table>
Where name like ‘hello%’
select * from cte
where name not like ‘%world’
Regards,
Sofiya Li
Sofiya Li
TechNet Community Support -
Code to check whether a given string contains alphanumeric
Can anyone post the Code to check whether a given string contains only alphanumeric and no special characters
<Rule name='isAlphaNumericString'>
<RuleArgument name='testStr'/>
<block>
<defvar name='counter'>
<i>0</i>
</defvar>
<defvar name='splitString'>
<while>
<lt>
<ref>counter</ref>
<length>
<ref>testStr</ref>
</length>
</lt>
<append name='splitList'>
<substr>
<ref>testStr</ref>
<ref>counter</ref>
<i>1</i>
</substr>
</append>
<set name='counter'>
<add>
<ref>counter</ref>
<i>1</i>
</add>
</set>
</while>
<ref>splitList</ref>
</defvar>
<containsAll>
<list>
<s>A</s>
<s>B</s>
<s>C</s>
<s>D</s>
<s>E</s>
<s>F</s>
<s>G</s>
<s>H</s>
<s>I</s>
<s>J</s>
<s>K</s>
<s>L</s>
<s>M</s>
<s>N</s>
<s>O</s>
<s>P</s>
<s>Q</s>
<s>R</s>
<s>S</s>
<s>T</s>
<s>U</s>
<s>V</s>
<s>W</s>
<s>X</s>
<s>Y</s>
<s>Z</s>
<s>a</s>
<s>b</s>
<s>c</s>
<s>d</s>
<s>e</s>
<s>f</s>
<s>g</s>
<s>h</s>
<s>i</s>
<s>j</s>
<s>k</s>
<s>l</s>
<s>m</s>
<s>n</s>
<s>o</s>
<s>p</s>
<s>q</s>
<s>r</s>
<s>s</s>
<s>t</s>
<s>u</s>
<s>v</s>
<s>w</s>
<s>x</s>
<s>y</s>
<s>z</s>
<s>0</s>
<s>1</s>
<s>2</s>
<s>3</s>
<s>4</s>
<s>5</s>
<s>6</s>
<s>7</s>
<s>8</s>
<s>9</s>
</list>
<ref>splitString</ref>
</containsAll>
</block>
</Rule>
It Retruns 1 if it contains only alphanumeric otherwise 0 -
Unique regular expression to check if a string contains letters and numbers
Hi all,
How can I verify if a string contains numbers AND letters using a regular expression only?
I can do that with using 3 different expressions ([0-9],[a-z],[A-Z]) but is there a unique regular expression to do that?
Thanks allDarin.K wrote:
Missed the requirements:
single regex:
^([[:alpha:]]+[[:digit:]]+|[[:digit:]]+[[:alpha:]])[[:alnum:]]*$
You either have 1 or more digits followed by 1 or more letters or 1 or more letters followed by 1 or more digits. Once that is out of the way, the rest of the string must be all alphanumerics. The ^ and $ make sure the whole string is included in the match.
(I have not tested this at all, just typed it up hopefully I got all the brackets in the right place).
I think you just made my point. TWICE. While the lex class would be much more readable as a ring.... I know all my brackets are in the correct places and don't need to hope.
Jeff -
excel problem
i have problem in excel when i write Arabic or i receive any excel file contain Arabic word it come like letters it do not come like word
my Microsoft office is 2011
what i can doMS Office for Mac does not really support Arabic. But you may just have a font problem. Disconnected letters means a Windows font is being used. Change the font to a Mac font like Geeza Pro.
For better Arabic support, try OpenOffice. -
To check that string contains space
Hi...
I have one char string, If that string contains any space then I want to display a message.
how to check that string contains 'space'.
Regards,
RohitHi, you can do a small work.
you can split the char string into substrings at spaces.
if there is space then it will be splitted and then you can check the sy-subrc.
if sy-subrc = 0,
then the char string had some space in it.
regards
jayati -
Returning strings from OLE2 Word object (Forms 4.5)
Below is an example of how to return string and numeric values from OLE2 objects. In this example the OLE2 object is a MS Word document, and I want to fetch all the bookmarks in the Document into a Forms 4.5 Varchar2. To do this I first need to get the count of bookmarks.
Getting a string property from an OLE2 object is a common OLE2 requirement but is poorly documented. This is the ONLY way it can be done, as OLE2.INVOKE_CHAR returns a single character not a string. Use OLE2.INVOKE_OBJ, then OLE2.GET_CHAR_PROPERTY which does return a string, as shown below, to return a string from an OLE object (or OLE property).
Also note how you can only get the child object from its parent, not the grandchild (etc) object, so multiple (cascading) GET_OBJ_PROPERTY calls are required.
/* by: Marcus Anderson (Anderson Digital) (MarcusAnderson.info) */
/* name: Get_Bookmarks */
/* desc: Returns a double quoted CSV string containing the document*/
/* bookmarks. CSV string will always contain a trailing comma*/
/* EG: "Bookmark1","Bookmark2",Bookmark3",Bookmark4", */
/* NB: This requires that Bookmarks cannot contain " chr */
PROCEDURE Get_Bookmarks (pout_text OUT VARCHAR2)
IS
v_text VARCHAR2(80);
v_num NUMBER(3);
v_arglist OLE2.LIST_TYPE;
v_Application OLE2.OBJ_TYPE;
v_ActiveDoc OLE2.OBJ_TYPE;
v_Bookmarks OLE2.OBJ_TYPE;
v_Item OLE2.OBJ_TYPE;
v_i NUMBER(3);
BEGIN
v_Application := LDWord.MyApplication; -- Word doc opened elsewhere
/* Set v_num = ActiveDocument.Bookmarks.Count */
v_ActiveDoc := OLE2.GET_OBJ_PROPERTY (v_Application, 'ActiveDocument');
v_Bookmarks := OLE2.GET_OBJ_PROPERTY (v_ActiveDoc , 'Bookmarks');
v_num := OLE2.GET_NUM_PROPERTY (v_Bookmarks, 'Count'); -- NB: Returns numeric property
/* Build the output string, pout_text. */
FOR v_i in 1..v_num LOOP
/* Set v_item = ActiveDocument.Bookmarks.Item(v_i) */
v_arglist := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG (v_arglist, v_i);
v_Item := OLE2.INVOKE_OBJ (v_Bookmarks, 'Item', v_arglist); -- NB: returns parent object (array element)
OLE2.DESTROY_ARGLIST (v_arglist);
/* Set v_text = ActiveDocument.Bookmarks.Item(v_i).Name */
v_text := OLE2.GET_CHAR_PROPERTY (v_Item, 'Name'); -- NB: Returns string/varchar2 property
pout_text := pout_text || '"' || v_text || '",' ;
END LOOP;
END;Please repost in the Forms discussion forum.
- OTN -
Hi Everyone,
I've been battling with this for a while and I'm getting nowhere. I'm attempting to install DPM 2012R2 onto a fresh VM with a local SQL installation. The setup is as follows:
Server OS: 2008R2 SP1
SQL: 2008 R2 standard with SP3(tried SP2 before this)
Collation: SQL_Latin1_General_CP1_CI_AS
Reporting services installed: Yes(ticked do not configure during the installation)
Enabled reporting servics on port 80 with the default URL
DPM Installation does not throw any errors during the preinstall stage(The server passes all the checks)
Basically, when Installing. I get this error(extract):
at Microsoft.Internal.EnterpriseStorage.Dls.UI.Library.Reporting.Reporter.DeployFileInServer(Boolean recreate, ReportDBInfo rptInfo)
at Microsoft.Internal.EnterpriseStorage.Dls.UI.Library.Reporting.Reporter.DeployReports(String sourceFolderPath, Boolean recreate, Boolean calledFromSetup)
at Microsoft.Internal.EnterpriseStorage.Dls.UI.Library.Reporting.Reporter.InstallReports(Boolean calledFromSetup, String sourceFolderPath, String sqlServerName, String sqlInstanceName, String dbConnectionString)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at Microsoft.Internal.EnterpriseStorage.Dls.Setup.Wizard.ReportingConfiguration.DeployReports(Boolean isRemoteReporting, String sqlMachineName, String sqlInstanceName, String rsMachineName, String rsInstanceName, String installerPath)
[10/12/2014 2:35:25 p.m.] * Exception : => Report configuration failed.Verify that SQL Server Reporting Services is installed properly and that it is running.Microsoft.Internal.EnterpriseStorage.Dls.Setup.Exceptions.BackEndErrorException: exception
---> Microsoft.Internal.EnterpriseStorage.Dls.Setup.Exceptions.ReportDeploymentException: exception ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.Internal.EnterpriseStorage.Dls.UI.Library.Reporting.ReportingException:
exception ---> System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: The report definition is not valid or supported by this version of Reporting Services. This could be the result of publishing a report definition of
a later version of Reporting Services, or that the report definition contains XML that is not well-formed or the XML is not valid based on the Report Definition schema. Details: Root element is missing.
at Microsoft.ReportingServices.WebServer.ReportingService2005Impl.CreateReport(String Report, String Parent, Boolean Overwrite, Byte[] Definition, Property[] Properties, Warning[]& Warnings)
at Microsoft.ReportingServices.WebServer.ReportingService2005.CreateReport(String Report, String Parent, Boolean Overwrite, Byte[] Definition, Property[] Properties, Warning[]& Warnings)
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at Microsoft.Internal.EnterpriseStorage.Dls.UI.Reporting.ReportingService2005.CreateReport(String Report, String Parent, Boolean Overwrite, Byte[] Definition, Property[] Properties)
at Microsoft.Internal.EnterpriseStorage.Dls.UI.Library.Reporting.Reporter.CreateReport(String pathOfReport, ReportDBInfo rptInfo)
--- End of inner exception stack trace ---
at Microsoft.Internal.EnterpriseStorage.Dls.UI.Library.Reporting.Reporter.CreateReport(String pathOfReport, ReportDBInfo rptInfo)
at Microsoft.Internal.EnterpriseStorage.Dls.UI.Library.Reporting.Reporter.DeployFileInServer(Boolean recreate, ReportDBInfo rptInfo)
at Microsoft.Internal.EnterpriseStorage.Dls.UI.Library.Reporting.Reporter.DeployReports(String sourceFolderPath, Boolean recreate, Boolean calledFromSetup)
at Microsoft.Internal.EnterpriseStorage.Dls.UI.Library.Reporting.Reporter.InstallReports(Boolean calledFromSetup, String sourceFolderPath, String sqlServerName, String sqlInstanceName, String dbConnectionString)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at Microsoft.Internal.EnterpriseStorage.Dls.Setup.Wizard.ReportingConfiguration.DeployReports(Boolean isRemoteReporting, String sqlMachineName, String sqlInstanceName, String rsMachineName, String rsInstanceName, String installerPath)
--- End of inner exception stack trace ---
at Microsoft.Internal.EnterpriseStorage.Dls.Setup.Wizard.ReportingConfiguration.DeployReports(Boolean isRemoteReporting, String sqlMachineName, String sqlInstanceName, String rsMachineName, String rsInstanceName, String installerPath)
at Microsoft.Internal.EnterpriseStorage.Dls.Setup.Wizard.BackEnd.DeployReports(String reportserverConfigFilePath, Boolean isOemSetup, String sqlMachineName, String sqlInstanceName, Boolean isRemoteReporting, String reportingServerMachineName, String
reportingInstanceName)
--- End of inner exception stack trace ---
at Microsoft.Internal.EnterpriseStorage.Dls.Setup.Wizard.BackEnd.DeployReports(String reportserverConfigFilePath, Boolean isOemSetup, String sqlMachineName, String sqlInstanceName, Boolean isRemoteReporting, String reportingServerMachineName, String
reportingInstanceName)
at Microsoft.Internal.EnterpriseStorage.Dls.Setup.Wizard.DpmInstaller.DeployReports(Boolean isRemoteReporting, Boolean isUpgrade)
at Microsoft.Internal.EnterpriseStorage.Dls.Setup.Wizard.ProgressPage.InstallerThreadEntry()
*** Mojito error was: ReportDeploymentFailed; 0; None
[10/12/2014 2:35:25 p.m.] *** Error : Report configuration failed.
Verify that SQL Server Reporting Services is installed properly and that it is running.
ID: 812
[10/12/2014 2:35:25 p.m.] Information : Data Protection Manager installation has failed. All the items that were copied during the installation process have been removed.
For details, click the Error tab.
Any ideas?
I've managed to get it to this stage. Originally I didn't have encryption keys or a listening port(which I fixed).Can you try following steps:
If there are SSL certificates on your computer, by default SQL 2008
installation configures HTTPS for reporting websites. When DPM tries to
deploy reports on these websites it may fail if the reporting websites
are not accessible (might be due to invalid/expired certificates). To
workaround this, provided you do not require HTTPS for reporting websites do
the following:
1. Edit C:\Program Files\Microsoft DPM\SQL\MSRS10.MSDPMV3BETA1EVAL\Reporting
Services\ReportServer\rsreportserver.config
2. Set the SecureConnectionLevel to 0 if the current value is 2 (A value to
2 means secure connection is required)
3. Connect to SQL reporting service configuration manager and connect to the
instance MSDPMV3BETA1EVAL
4. Click on Web Service URL, click advanced and remove SSL identities
5. Repeat the above for Report Manager URL
6. Make sure report manager URL and web service URL are accessible with out
any errors.
6. Restart report server
If that doesn't solve the problem, please try following steps:
1. Open Start-> All programs->SQL server 2008->Configuration Tools->Report
Server Configuration Manager
2. Connect to the instance which the DPM is using to install.
3. Browse Report Manager URL and web service url
4. If report manager URL or web service url throws any error say 500 or 404
fix the error. (Try also replacing machine name with localhost in url)
5. Otherwise delete DPMReports folder (if present) using below instructions
6. Restart reporting services
7. Try DPM setup again.
Deleting DPM reports:
1. Open report manager URL in IE
2. Click show details on right hand side
3. Put a tick against DPMReports folder
4. Click Delete button.
Regards, Trinadh [MSFT] This posting is provided AS IS with no warranties, and confers no rights. If you found the reply helpful, please MARK IT AS ANSWER. Looking for source of information for DPM? http://blogs.technet.com/b/dpm/ http://technet.microsoft.com/en-in/library/hh758173.aspx -
Hello,
If i have the string 'test1 test2-ttt test3'.. how can i split the string in two strings, so the 1st string contains the 1st word and the second the words after the first space?
e.g. in my case str1 = test1 and str2 = test2-ttt test3
i tried with
select substr('test1 test2-ttt test3', 1, instr('test1 test2-ttt test3', ' ', instr(''test1 test2-ttt test3', ' ')+1)-1)
from dual;but it's not the expected result..
Thanks in advance!did you need somethink like this
select a.word1, substr('test1 test2-ttt test3',length(a.word1)+1,instr('test1 test2-ttt test3',' ')) from
select substr('test1 test2-ttt test3',1,instr('test1 test2-ttt test3',' ')-1) word1 from dual
) a
, dual bEdited by: Adigozalov Gurban on Jan 25, 2011 10:46 AM -
Check string for two special characters back to back
Hey all so I need to check if a string has 2 backslashes back to back ("\\"). So the string "\\computername\c$\file" would match but the string "C:\file\path" would not. I've tried contains, match, and like. I've tried the code
below which does work but gives me a false positive when I have a string like this "\computername\file\path".
$com = "\\computername\C$"
if($com -match "\\"){
Write-Host true
}else{
Write-Host false
Thanks for any help!In Regex ^ matches the starting position of a string. \ is a special character in Regex so you need to escape it with another \, so since you want double backslash \\, you need to escape twice \\\\, so ultimately ^\\\\ reads, at the start of the string
find \\
If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.
Don't Retire Technet
Maybe you are looking for
-
Indesign to PDF - Font showing up as small boxes
I am exporting an Indesign Document to PDF. The font in parts of the document are showing up as small boxes, and are not translating to you PDF version correctly when viewed in Adobe Acrobat Pro. The document is too large to outline all they text, I
-
"Referenced" Table Cells not copying formatting of the source table
Hi- I have one sheet that has a rental inventory table that is quite large. On another page, I have a "printable" version that has filtering applied to hide certain columns. What I did orginally was duplicate the table on the inventory page, cut it,
-
Safari keeps crashing on my mac air
Safari has crashed three time already. One two weeks ago and then again a couple of days ago and thrice right now.... I'm just wondering what is wrong with it. Process: com.apple.WebKit.WebContent [597] Path: /System/Library/Staged
-
Certificate of Networthiness (CON)
Can someone at Adobe or another user let me know if Robohelp 7 has an Army Certificate of Networthiness (CON). I thought since it's Adobe it was a given but I guess not because I do not see it on the list.
-
Hi everyone. Well, I'm hoping I can enlist your help here to get me up and going. Here is my scenario:?. Using Windows Vista 32-bit2. I have the standard Soundblaster XFI card that Dell puts in the XPS machines (I believe it is an ExtremeMusic if I h