Thread: String splitting

  1. #1
    Banned
    Join Date
    Apr 2015
    Posts
    596

    String splitting

    Hi guys,
    I'm wondering if there's in C programming function that I can use for specifying what I want from the string. I mean for example in python if I have str="abcd", and I want just first two chars, then I simple can do str[str:str+2] and this gives me "ab", is there something like that in C programming I can use for getting what I want from string? for example if I need just three chars from the string .. what's the function for that? thanks alot!!

  2. #2
    Registered User
    Join Date
    May 2012
    Location
    Arizona, USA
    Posts
    653
    How is this different from Slicing's string concept.?

  3. #3
    Registered User catacombs's Avatar
    Join Date
    May 2019
    Location
    /home/
    Posts
    72
    There aren't any string splitting functions, as far as I know.

    You could write your own function that returns the first three characters in a string, which, as we all know, is just an array of characters.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    37,418
    More re-heating of old food from the help vampire ryanc
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help on splitting string in C
    By bladez in forum C Programming
    Replies: 11
    Last Post: 02-21-2018, 10:02 AM
  2. splitting a string.
    By Romyo2 in forum C Programming
    Replies: 27
    Last Post: 06-11-2015, 04:41 PM
  3. splitting a string.
    By Romyo2 in forum C Programming
    Replies: 7
    Last Post: 05-08-2015, 11:40 AM
  4. Splitting up a string
    By monki000 in forum C Programming
    Replies: 12
    Last Post: 03-04-2010, 12:40 PM
  5. splitting a string
    By smegly in forum C Programming
    Replies: 6
    Last Post: 05-20-2004, 12:04 PM

Tags for this Thread