How do I get the first word from a text divided by “.” [duplicate]

How do I get the first word from a text divided by “.” [duplicate]



This question already has an answer here:



Here's an example of what I need:



This is the text: sample.dbo.Productos



And I just want the word: "sample"



This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






What did you tried?

– Januson
Sep 14 '18 at 21:46






String sample = str.split("\.")[0]; Where str is your String

– GBlodgett
Sep 14 '18 at 21:46


String sample = str.split("\.")[0];


str


String






Hint: docs.oracle.com/javase/10/docs/api/java/lang/…

– Jacob G.
Sep 14 '18 at 21:47







@GBlodgett just what I need, thank you so much.

– Vinicio López
Sep 14 '18 at 21:51




1 Answer
1



Quite simply:



String extractFirstWord = yourText.split(".")[0]


String extractFirstWord = yourText.split(".")[0]



Here, yourText = "sample.dbo.Productos";


yourText = "sample.dbo.Productos";

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)