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. Web Development
  3. How to detect changes from Lowercase to Uppercase?

How to detect changes from Lowercase to Uppercase?

Scheduled Pinned Locked Moved Web Development
tutorialcsharpasp-netquestion
4 Posts 2 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.
  • H Offline
    H Offline
    hifiger2004
    wrote on last edited by
    #1

    Hi Guys, I am using ASP.Net VB Coding. Does anyone of you knows how to detect changes from lowercase to uppercase or mixtures of lowercase and uppercase? Example: Textbox1.text = "Australia" was then changed to Textbox1.text = "AUstRALia" Looking at the example it shows here that the user was doing some text changes from "Australia" to "AUstRALia". Is there a way to check the changes of the textbox value? Thanks in advance Guys

    hifiger2004

    N 1 Reply Last reply
    0
    • H hifiger2004

      Hi Guys, I am using ASP.Net VB Coding. Does anyone of you knows how to detect changes from lowercase to uppercase or mixtures of lowercase and uppercase? Example: Textbox1.text = "Australia" was then changed to Textbox1.text = "AUstRALia" Looking at the example it shows here that the user was doing some text changes from "Australia" to "AUstRALia". Is there a way to check the changes of the textbox value? Thanks in advance Guys

      hifiger2004

      N Offline
      N Offline
      newc1
      wrote on last edited by
      #2

      If you simply want to check the individual characters of the input string on the server, then something like the below would do the trick: Dim fEmptyBefore As Boolean For Each ch As Char In stringInput If [Char].IsWhiteSpace(ch) Then fEmptyBefore = True Else If [Char].IsLetter(ch) Then If [Char].IsLower(ch) AndAlso fEmptyBefore Then ' We have a lower case letter at the start of a word Else If [Char].IsLower(ch) And Not fEmptyBefore Then ' We have an upper case letter in the middle of a word End If End If fEmptyBefore = False End If Next You can then handle any instances where the casing is not as expected and take appropriate action. If you wish to validate / check the input on the client then there are ways to do this using JavaScript, but it would depend on what it is you are trying to achieve as to how you would approach the problem.

      Clean code is the key to happiness.

      H 1 Reply Last reply
      0
      • N newc1

        If you simply want to check the individual characters of the input string on the server, then something like the below would do the trick: Dim fEmptyBefore As Boolean For Each ch As Char In stringInput If [Char].IsWhiteSpace(ch) Then fEmptyBefore = True Else If [Char].IsLetter(ch) Then If [Char].IsLower(ch) AndAlso fEmptyBefore Then ' We have a lower case letter at the start of a word Else If [Char].IsLower(ch) And Not fEmptyBefore Then ' We have an upper case letter in the middle of a word End If End If fEmptyBefore = False End If Next You can then handle any instances where the casing is not as expected and take appropriate action. If you wish to validate / check the input on the client then there are ways to do this using JavaScript, but it would depend on what it is you are trying to achieve as to how you would approach the problem.

        Clean code is the key to happiness.

        H Offline
        H Offline
        hifiger2004
        wrote on last edited by
        #3

        Yes I think this will help. What I am trying to do is to track the changes of a particular textbox in order to make the save button either enabled or disabled. And if the textbox value is "australia", then was changed to "AUSTRALIA" and then again was changed back to "australia" then in this case the save button should be in disabled state. Meaning nothing was changed. Thanks

        hifiger2004

        N 1 Reply Last reply
        0
        • H hifiger2004

          Yes I think this will help. What I am trying to do is to track the changes of a particular textbox in order to make the save button either enabled or disabled. And if the textbox value is "australia", then was changed to "AUSTRALIA" and then again was changed back to "australia" then in this case the save button should be in disabled state. Meaning nothing was changed. Thanks

          hifiger2004

          N Offline
          N Offline
          newc1
          wrote on last edited by
          #4

          The best way to achieve this would be to use regular expressions through JavaScript. When the page loads you would save a global variable, or hidden field, that contains the value of the TextBox and on every keystroke within the TextBox, call a JS funtion that uses RegEx to determine whether the current value is different from the original. The original value would be used in the compilation of the expression. If you Google RegEx and JavaScript, there are plenty examples out there that will show you what is required. Basically, based on the result of the RegEx test you will get a boolean value telling you if the values are the same (case differences will be picked up) and you then enable / disable the Save button as required.

          Clean code is the key to happiness.

          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