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

  • Home
  • SEARCH
  • 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 8970249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:42:15+00:00 2026-06-15T17:42:15+00:00

Premise So I’m trying to break up a given String into a list of

  • 0

Premise

So I’m trying to break up a given String into a list of characters, these characters will then be edited/changed and reassigned into the list after which the list will be reconstructed back into a String.

An example:

Given String : "ABCDEFG"

Character list : [A,B,C,D,E,F,G]

Operation changes the list to something like the following:
[E,F,G,H,I,J,K] (Or something similar).

And then gets reconstructed into a String:

"EFGHIJK"

Question

I am looking for a way to access individual elements inside of a String. If it were Java I would use a command like charAt(int i) but I don’t know if such a command exists within prolog.

Note

I am a new prolog programmer so I’m not familiar with most prolog operations.

Thanks for your time.

  • 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-06-15T17:42:16+00:00Added an answer on June 15, 2026 at 5:42 pm

    A string it’s a list of char codes, while an atom it’s, well, atomic, i.e. indivisible, but there is sub_atom/5 to access parts of the atomic data.

    Here some string example:

    1 ?- L = "ABCDEF".
    L = [65, 66, 67, 68, 69, 70].
    
    2 ?- L = "ABCDEF", maplist(succ, L, N), format('~s', [N]).
    BCDEFG
    L = [65, 66, 67, 68, 69, 70],
    N = [66, 67, 68, 69, 70, 71].
    
    3 ?- L = "ABCDEF", maplist(succ, L, N), format('~s', [N]), atom_codes(A, N).
    BCDEFG
    L = [65, 66, 67, 68, 69, 70],
    N = [66, 67, 68, 69, 70, 71],
    A = 'BCDEFG'.
    

    If the analysis and transformation require detail then usually it’s better to use DCGs

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Premise: I'm not trying to reinvent the wheel, I'm just trying to understand. Output
The basic premise is I want to find a character following another and then
When I study about cloud-computing, I usually see these terms: on-premise, off-premise applications. I
I'm trying to create some sort of many-to-one association. The basic premise is a
Premise I recently ran into a bug in a select statement in my code.
Given the premise: There are competent sql programmers (correlary - writing sql queries are
I am trying to test a basic premise in python and it always fails
PREMISE : The application code cannot be changed. The conditions are very specific. I
I am trying to connect to CRM 2011 on premise from windows azure worker
Premise: I come from C++ and I'm pretty noob at Perl. I'm trying to

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.