Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4347496
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T12:18:51+00:00 2026-05-21T12:18:51+00:00

I am trying to delete every character from the beginning of my string, that

  • 0

I am trying to delete every character from the beginning of my string, that is not an Alpha-character.

However, when there are only non-alpha characters (like “!!” or “?!?”) in the string, it spits out an Access Violation!

Here is my code:

  // The Log(); is a routine that adds stuff to my log memo.
  Log('Begin Parse');
  while not IsLetter(ParsedName[1]) do
   begin
     Log('Checking Length - Length is '+IntToStr(Length(ParsedName))+' ...');
     if Length(ParsedName) <> 0 then
     Begin
     Log('Deleting Char ...');
     Delete(ParsedName,1,1);
     Log('Deleted Char ...');
     End;
     Log('Checking Length - Length is now '+IntToStr(Length(ParsedName))+' ...');
   end;
   // It never reaches this point!
   Log('End Parse');

This is what my log produces:

21:51:19: Checking Length - Length is 2 ...
21:51:19: Deleting Char ...
21:51:19: Deleted Char ...
21:51:19: Checking Length - Length is now 1 ...
21:51:19: Checking Length - Length is 1 ...
21:51:19: Deleting Char ...
21:51:19: Deleted Char ...
21:51:19: Checking Length - Length is now 0 ...
21:51:19: Access violation at address 007A1C09 in module 'Project1.exe'. Read of address 00000000 

As you see, it happens right after all the chars have been deleted. I assume the problem lies that somehow, I am trying to access something that is not there, but how I am doing that, I cannot see.

EDIT: Yes, I know it’s a stupid question and all that stuff – I just oversaw something. Don’t tell me that doesen’t ever happen to you 😉

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T12:18:52+00:00Added an answer on May 21, 2026 at 12:18 pm

    This question has nothing to do with Delete. Delete works even if you tell it to delete characters that do not exist.

    The line

    while not IsLetter(ParsedName[1]) do
    

    tries to access ParsedName[1], so this character has better to exist. Your code isn’t particularly beautiful, but a simple workaround is

    while (length(ParsedName) > 0) and not IsLetter(ParsedName[1]) do
    

    You can do just

    while (length(ParsedName) > 0) and not IsLetter(ParsedName[1]) do
      Delete(ParsedName, 1, 1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to delete every follower from an array using PHP. However I
I'm trying to write a function that will delete every row in a given
I am trying to write some code that uses SQL to delete rows from
I am creating a console app that will delete pictures from a directory every
I am trying to delete MySQL table rows from a Web page using Perl.
I'm trying to delete a specific line by id from a file in C++
I'm trying to delete certain lines from a file. My file is a .txt
When I'm trying to delete an external event from my calendar, if I add
I'm trying to get a simple delete every pointer in my vector/list/... function written
Somebody explain to me this: I am trying to delete items from a list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.