Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. are there any functions in java like ispunct, isspace in C_?

are there any functions in java like ispunct, isspace in C_?

Scheduled Pinned Locked Moved Java
javaquestion
9 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    quartaela
    wrote on last edited by
    #1

    hi there i am trying write a function that checks if a string contains punctuation characters like %,&,!. because i dont want to user enter an invalid name last_name so i want check the string.

    L J R 3 Replies Last reply
    0
    • Q quartaela

      hi there i am trying write a function that checks if a string contains punctuation characters like %,&,!. because i dont want to user enter an invalid name last_name so i want check the string.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      A quick Google search finds this page[^].

      Unrequited desire is character building.

      Q 1 Reply Last reply
      0
      • L Lost User

        A quick Google search finds this page[^].

        Unrequited desire is character building.

        Q Offline
        Q Offline
        quartaela
        wrote on last edited by
        #3

        well yes i know this class but i guess there arent any specific functions which they check specific characters. as you see in the link http://cplusplus.com/reference/clibrary/cctype/ there are several functions. but in java i can't check a string contains only alphabetic characters_?

        D L 2 Replies Last reply
        0
        • Q quartaela

          well yes i know this class but i guess there arent any specific functions which they check specific characters. as you see in the link http://cplusplus.com/reference/clibrary/cctype/ there are several functions. but in java i can't check a string contains only alphabetic characters_?

          D Offline
          D Offline
          David Skelly
          wrote on last edited by
          #4

          You can do this using regular expressions. A google search for "java regular expression" will give you some good links.

          Q 1 Reply Last reply
          0
          • D David Skelly

            You can do this using regular expressions. A google search for "java regular expression" will give you some good links.

            Q Offline
            Q Offline
            quartaela
            wrote on last edited by
            #5

            thanks mate i will try it then : )

            1 Reply Last reply
            0
            • Q quartaela

              well yes i know this class but i guess there arent any specific functions which they check specific characters. as you see in the link http://cplusplus.com/reference/clibrary/cctype/ there are several functions. but in java i can't check a string contains only alphabetic characters_?

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              The Java functions mirror the same functions in C and cover most of what you need.

              Unrequited desire is character building.

              1 Reply Last reply
              0
              • Q quartaela

                hi there i am trying write a function that checks if a string contains punctuation characters like %,&,!. because i dont want to user enter an invalid name last_name so i want check the string.

                J Offline
                J Offline
                jschell
                wrote on last edited by
                #7

                quartaela wrote:

                because i dont want to user enter an invalid name last_name

                How exactly did you determine that such characters would be invalid in the name? Or more specifically is this a business requirement? And what exactly do you think the business process will be if someones legal names does have one of the characters that you excluded?

                Q 1 Reply Last reply
                0
                • Q quartaela

                  hi there i am trying write a function that checks if a string contains punctuation characters like %,&,!. because i dont want to user enter an invalid name last_name so i want check the string.

                  R Offline
                  R Offline
                  ramu143
                  wrote on last edited by
                  #8

                  i think we don't have ispunct,isspace methods in java,if you observe JAVA API you may get clarity.If you know exactly please keep sample code in site along related documentation.

                  1 Reply Last reply
                  0
                  • J jschell

                    quartaela wrote:

                    because i dont want to user enter an invalid name last_name

                    How exactly did you determine that such characters would be invalid in the name? Or more specifically is this a business requirement? And what exactly do you think the business process will be if someones legal names does have one of the characters that you excluded?

                    Q Offline
                    Q Offline
                    quartaela
                    wrote on last edited by
                    #9

                    hey sorry for late answer : ). nope this is not a business requirement only a little work. so i mean you can not use "!+^%.." characters in name. for exmaple "Pe&%ter".

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups