Skip to content

Added Character Count functionality #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion textutils/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def analyze(request):
newlineremover = request.POST.get('newlineremover', 'off')
extraspaceremover = request.POST.get('extraspaceremover', 'off')
numberremover = request.POST.get('numberremover','off')
charcount = request.POST.get('charcount', 'off')

#Check which checkbox is on
if removepunc == "on":
Expand Down Expand Up @@ -69,6 +70,11 @@ def analyze(request):

params = {'purpose': 'Removed NewLines', 'analyzed_text': analyzed}
djtext = analyzed
if charcount == "on":
chrcount = ""
chrcount = len(djtext)
params = {'purpose': 'Character Count', 'analyzed_text': analyzed,
'chrcount': f'Total Number of characters are {chrcount}'}


if(removepunc != "on" and newlineremover!="on" and extraspaceremover!="on" and fullcaps!="on" and numberremover != "on"):
Expand All @@ -77,4 +83,4 @@ def analyze(request):
return render(request, 'analyze.html', params)

def about(request):
return render(request, 'about.html')
return render(request, 'about.html')