There a few ways.  One way is to use .split()

Such as:

some_var.split(':')[0]

On Thursday, November 12, 2015, Eric Franckx <[email protected]> wrote:

> Is there a advance substr( var, ':', 0) ---> to get from the begin of the
> string the substring ?
>
> On Thursday, 12 November 2015 14:13:16 UTC+1, Eric Franckx wrote:
>>
>> Hi,
>>
>> if I have a string/var  with hostname_01.com:28569, how can I use the
>> hostname part (hostname_01 and don"t use the :28569)  to be use in an
>> action ?
>>
>> Regards,
>>
>>
> ------------------------------
>
> This email is sent on behalf of Northgate Information Solutions Limited
> and its associated companies ("Northgate") and is strictly confidential and
> intended solely for the addressee(s).
>
> If you are not the intended recipient of this email you must: (i) not
> disclose, copy or distribute its contents to any other person nor use its
> contents in any way or you may be acting unlawfully;  (ii) contact
> Northgate immediately on +44 (0)1442 232424 quoting the name of the sender
> and the addressee then delete it from your system.
>
> Northgate has taken reasonable precautions to ensure that no viruses are
> contained in this email, but does not accept any responsibility once this
> email has been transmitted.  You should scan attachments (if any) for
> viruses.
> ------------------------------
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected]
> <javascript:_e(%7B%7D,'cvml','ansible-project%[email protected]');>
> .
> To post to this group, send email to [email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/873a3971-60f7-4dde-850e-bfdef0697800%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/873a3971-60f7-4dde-850e-bfdef0697800%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Matt Martz
@sivel
sivel.net

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v8_yoOVCESR5m76k2b7VaE2fEEBb8nc5emFmcpkzeGZCg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to