Skip to main content
April 5, 2011
Question

Splitting the IP address string

  • April 5, 2011
  • 2 replies
  • 321 views

Hi,

I have an IP address in a variable. I want to split the IP address in such a way that I will get the last part of IP address in another variable. please help.

<CFPARAM name="IPaddr" default="10.22.134.56">

My Variable IPaddr changes dynamically in code

I want to get last part 56(any dynamic value) in another variable. any ideas?

    This topic has been closed for replies.

    2 replies

    12Robots
    Participating Frequently
    April 5, 2011

    While Owain is right, I will provide a bit more than "RTFM", but not much more.

    <cfset last = listlast(ipaddr, ".") />

    You should check out the list functions, as Owain suggested. Lots of good stuff out there.

    Owainnorth
    Inspiring
    April 5, 2011

    List functions are your friend.