devxlogo

Displaying Retrieved Text in a Certain Manner

Displaying Retrieved Text in a Certain Manner

Question:
When char data is retrieved, is there a way to display it in a certain way? An example would be a phone number. If the phone number data is nothing but a string of numbers, is there a way to tell the query to output it as 123-456-7890 instead of 1234567890?

Answer:
Yes you can. Two things come to mind: one is to create a rule on the column that enforces the pattern you want; the other is to give the illusion of those marks by planting them in your SQL statement so that the result comes back with the embedded dashes, etc.

See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist